例如开机自启动nginx
编写一个脚本
#vi /usr/local/Monitor_nginx.sh
#!/bin/bash
if [ "$(ps -ef | grep "nginx: master process"| grep -v grep )" == "" ]
then
/usr/local/nginx/sbin/nginx
fi
#chmod u+x /usr/local/Monitor_nginx.sh
#vi /etc/rc.local
sh /usr/local/Monitor_nginx.sh