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
#运行进程

 

posted @ 2021-02-25 14:59  鸭子船长  阅读(1519)  评论(0编辑  收藏  举报