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
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
相关文章推荐
- My way on Linux - [Shell基础] - Bash Shell中判断文件、目录是否存在或者判断其是否具有某类属性(权限)的常用方法
- shell 判断进程是否存在
- Shell脚本执行hive语句 | hive以日期建立分区表 | linux schedule程序 | sed替换文件字符串 | shell判断hdfs文件目录是否存在
- shell判断文件,目录是否存在或者具有权限 (转载)
- linux 判断某个进程是否存在,存在则重启,不存在则启动。
- shell脚本判断Apache进程是否存在
- Shell脚本判断Apache进程是否存在
- shell判断文件,目录是否存在或者具有权限
- shell判断文件,目录是否存在或者具有权限
- shell判断文件,目录是否存在或者具有权限
- shell判断文件,目录是否存在或者具有权限的代码
- linux下c调用shell命令,以及判断文件是否存在
- LINUX判断进程是否存在并启动该进程
- shell判断文件,目录是否存在或者具有权限的代码
- linux+笔记:linux下判断一个文件或者目录是否存在
- shell判断文件,目录是否存在或者具有权限
- Shell实现判断进程是否存在并重新启动脚本
- Shell脚本判断Apache进程是否存在
- perl多进程数量控制-信号或者判断pid是否存在
- Shell脚本中判断文件,目录是否存在或者具有权限