https://serverfault.com/questions/587696/how-to-restart-php-fpm-from-cron
我也遇到了这个问题,想用cron 来启动php-fpm进程(当检测到php-fpm 进程挂掉的时候)
#!/bin/bash pid=`ps aux|grep php-fpm|grep -v grep|awk '{print $2}'` if [[ $pid == '' ]] then service php5.6-fpm restart fi
------------------------------------------------------------------------------
I'm trying to restart PHP5-FPM periodically using Cron, but am having no luck.
I can restart manually with no problems, using service php5-fpm restart
or /usr/sbin/service php5-fpm restart
However, when I use the same command, including using the full path to /usr/sbin/service
, nothing happens. The cronjob does run (as I see from the syslog), but PHP5-FPM does not restart.
The relevant line of my root user's crontab looks as follows:
* * * * * /usr/sbin/service php5-fpm restart
I have confirmed with which service
that the path to service is indeed /usr/sbin/service
.
Why is this not working?