monit (monitoring system)

install monit

nano /etc/default/monit

1
startup=1

nano /etc/monit/monitrc

1
set daemon 30 #timeout to check objects

1
with start delay 240 # first check after start

1
set logfile syslog facility log_daemon

1
include /etc/monit/conf.d/* #config catalog

 

nano /etc/monit/conf.d/php-cgi

1
2
3
4
check process php-cgi with pidfile /var/log/nginx/php.pid<br />
 start program = "/etc/init.d/php-fastcgi"<br />
 stop program = "/usr/bin/killall php-cgi"<br />
 if failed unixsocket /tmp/php-cgi.sock then restart

1
 

 

/etc/init.d/monit restart

killall php-cgi and wait 4 minutes