if ! ps ax | grep -v grep | grep -v -i tmux | grep "theserver.jar" > /dev/null; then
echo "Server failed to start!"
else
echo "Server successfully started!"
fi
請問我怎麼用python做這個? 我想不出如何去做。請幫助:( 我可以使用使用os.system?Shell給Python的煩惱
在此先感謝。
你*嘗試*使用os.system(是的,你可以)。 – 2011-04-13 16:58:36
我可以試試os.system嗎?我沒有嘗試過任何東西,因爲我不知道該怎麼辦。 – Riki137 2011-04-13 16:58:46
os.system(「if!ps ax | grep -v grep | grep -v -i tmux | grep'theserver.jar'>/dev/null;然後 echo'服務器啓動失敗' else echo'服務器成功啓動!' fi「) – Riki137 2011-04-13 17:00:45