添加定时任务;每分钟执行一次,如下图所示:
全部的 redis,nginx,php,mysqld 判断并重启;
phpfpm_procnum=`ps -ef|grep “php-fpm”|grep -v grep|wc -l`
nginx_procnum=`ps -ef|grep “nginx”|grep -v grep|wc -l`
mysql_procnum=`ps -ef|grep “mysqld”|grep -v grep|wc -l`
redis_procnum=`ps -ef|grep “redis”|grep -v grep|wc -l`
if [ $phpfpm_procnum -eq 0 ]
then
echo “start php-fpm…”
/etc/init.d/php-fpm-71 start
elif [ $nginx_procnum -eq 0 ]
then
echo “start nginx…”
/etc/init.d/nginx start
elif [ $mysql_procnum -eq 0 ]
then
echo “start mysql…”
/etc/init.d/mysql start
elif [ $redis_procnum -eq 0 ]
then
echo “start redis…”
/etc/init.d/redis start
else
echo “no cmd”
fi
按上面的步骤再来一遍就可以了