Linux判断进程是否存在并启动该进程

1.Linux判断进程是否存在并启动该进程

#!/bin/bash

#grep -v "grep" 去掉grep进程 
PIDS=`ps -ef |grep myprocess |grep -v grep | awk '{print $1}'`
if [ "$PIDS" != "" ]; then
echo "myprocess is runing!"
else

#运行进程

./myprocess
fi

猜你喜欢

转载自blog.csdn.net/qq_41399894/article/details/89332275