私はbashスクリプトを初めて使用しましたが、stackoverflowのコードの1つが見つかりました。私はスクリプトとマージしますが、Pythonは実行しません。私がエコーしようとすると、いつも「良い」状態になります。 ps -ef | grep runserver*
を実行しようとすると、これが常に出てきて、pythonスクリプトが実行されていません。ここでPythonスクリプトを実行しているBashスクリプト
root 1133 0.0 0.4 11988 2112 pts/0 S+ 02:58 0:00 grep --color=auto runserver.py
私のコードです: -
#!/bin/sh
SERVICE='runserver*'
if ps ax | grep -v grep | grep $SERVICE > /dev/null
then
python /var/www/html/rest/runserver.py
python /var/www/html/rest2/runserver.py
else
echo "Good"
fi
の答えはここにあるhttp://stackoverflow.com/questions/2903354/bash-script-to-check-running-process – haifzhan
このヘルプはしましたか? https://stackoverflow.com/questions/4377109/shell-script-execute-a-python-program-from-within-a-shell-script – Windsooon
@HaifengZhang私はその例を使用していて、うまくいかなかった...だからこそ私は別の解決策を求めています – NickyMan