shell/ target=_blank class=infotextkey>shell脚本:
#!/bin/bash
# 判断python是否在运行
if ps aux | grep "python" > /dev/null
then
echo "Running"
else
echo "Stopped"
fi
说明:ps aux输出正在运行的进程,linuxjishu/14086.html target=_blank class=infotextkey>grep命令负责匹配python,以判断python进程是否在运行。