CentOS 监控进程崩溃自动重启
#!/bin/bash runck=`ps -fe |grep "httpd" |grep -v "grep" |wc -l` if [ $runck -eq 0 or 1 ]; then sudo service httpd restart else echo “run status starting” >>/var/log/run.log fi
本文参考学习:
http://www.linuxqq.net/archives/160.html
http://wangyan.org/blog/pid-auto-reboot-shell-html.html
http://www.fushanlang.com/blog/linux-shell-jin-cheng-jian-kong-yu-zi-dong-zhong-qi-2236/