Linux查看进程是否存在及启动或重启
#!/bin/bash #判断进程是否存在,如果不存在就启动它 PIDS=`ps aux |grep myprocess |grep -v grep | awk '{print $2}'` if [ "$PIDS" != "" ]; then echo "myprocess is runing!" else cd /root/ ./myprocess #运行进程
联系方式:emhhbmdfbGlhbmcxOTkxQDEyNi5jb20=
#!/bin/bash #判断进程是否存在,如果不存在就启动它 PIDS=`ps aux |grep myprocess |grep -v grep | awk '{print $2}'` if [ "$PIDS" != "" ]; then echo "myprocess is runing!" else cd /root/ ./myprocess #运行进程