Shell给Python带来麻烦
|
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吗?
提前致谢。
没有找到相关结果
已邀请:
2 个回复
坍锭嘉韭蓝
换成
或使用
或
。
烫珊
您需要WEXITSTATUS来修复os.system调用中的返回值。供您使用,只需将sshd替换为theserver.jar