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
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