【发布时间】:2023-04-14 15:05:01
【问题描述】:
我是 bash 脚本的新手,从 * 中找到了其中一个代码。我将它与我的脚本合并,它不运行 python。当我尝试回应时,它总是会“好”。当我尝试运行ps -ef | grep runserver* 时,它总是出现并导致python 脚本无法运行。
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
【问题讨论】:
-
这有帮助吗? *.com/questions/4377109/…
-
@HaifengZhang 我用了那个例子,但它不起作用......这就是为什么我要求另一个解决方案
-
@Aison 如果条件为真,我可以运行我的 python 脚本,但现在它总是转到 else 条件
-
能否提供
ps ax | grep -v grep | grep runserver的输出?