上海网站建设规划,成都市网站建设公,工程资质,小程序商城怎么推广一个php项目#xff0c;laravel框架#xff0c;使用了nginx php redis mysql 还有进程守护supervisor#xff0c;用于laravel的异步队列进程queue#xff0c;当服务器重启后有可能部分服务没有成功启动这个时候可以用定时任务去检查服务状态#xff0c;然后对不正常的自动…一个php项目laravel框架使用了nginx php redis mysql 还有进程守护supervisor用于laravel的异步队列进程queue当服务器重启后有可能部分服务没有成功启动这个时候可以用定时任务去检查服务状态然后对不正常的自动启动就可以。直接上shell代码
echo start...
nginx_procnumps -ef|grep nginx|grep -v grep|wc -l
mysql_procnumps -ef|grep mysqld|grep -v grep|wc -l
redis_procnumps -ef|grep redis|grep -v grep|wc -l
supervisorctl_procnumps -ef|grep supervisor|grep -v grep|wc -l
queue_procnumps -ef|grep queue|grep -v grep|wc -lif [ $redis_procnum -eq 0 ]
then echo start redis.../etc/init.d/redis restart
fi
if [ $mysql_procnum -eq 0 ]
then echo start mysqld.../etc/init.d/mysqld restart
fi
if [ $nginx_procnum -eq 0 ]
then echo start nginx... /etc/init.d/nginx restart
fi
if [ $supervisorctl_procnum -eq 0 ]
then echo start supervisor.../www/server/panel/pyenv/bin/supervisorctl restart all
elif [ $queue_procnum -eq 0 ]
thenecho start supervisor.../www/server/panel/pyenv/bin/supervisorctl restart queue:queue_00
fiecho end
建议设置成每3分钟运行一次。