您的位置:首页 > 运维架构 > Shell

linux判断进程或者cron是否存在shell

2013-04-07 17:05 405 查看
#!/bin/bash

var=$(ps -ef | grep process_name | grep -v grep | wc -l)

if [ $? = 0 ] ;

then

echo " this program is not exist!"

else

echo " this program is exist!"

fi

(process_name为进程名字)把以上存为一个.sh后缀的文件,执行方法: ./test.sh
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: