判断nginx
是否运行
#!/bin/bash
name='nginx'
num=$(ps -ef|grep $name |grep -vc grep)
if [ $num -ge 1 ]; then
echo "$name is running!"
else
echo "$name is not running!"
fi
判断php
脚本是否运行
#!/bin/bash
name='abc/cdn/run'
num=$(ps -ef|grep $name |grep -vc grep)
echo $num
if [ $num -ge 1 ]; then
echo "$name is running!"
else
echo "$name is not running!"
/app/php7.2/bin/php /app/www/cron/index.php abc/cdn/run &
fi
如有问题,可以QQ搜索群1028468525加入群聊,欢迎一起研究技术
转载请注明:shell判断脚本是否运行 出自老鄢博客 | 欢迎分享