
Well we have created a PHP daemon.One major issue with all daemon is that some time it got killed with out any reason.Here we have a solution for monitoring the daemon with a utility called monit.monit is a utility for managing and monitoring, processes, files, directories and devices on a Unix system. Monit conducts automatic maintenance and repair and can execute meaningful causal actions in error situations. E.g. monit can start a process if it does not run, restart a process if it does not respond and stop a process if it uses to much resources. You may use monit to monitor files, directories and devices for changes, such as timestamp changes, checksum changes or size changes.
For doing it install the utility first
sudo apt-get install monit
We have to edit some configuration file to make the monit work.
Edit sudo vim /etc/default/monit
Set startup=1 from 0
Edit sudo vim /etc/monit/monitrc
This is the file where we specify what to monit
Uncomment
set daemon 60 #will check the daemon every 1 minute set httpd port 2812 and use address localhost # only accept connection from localhost allow localhost # allow localhost to connect to the server and #specifying the program for monitor check process php with pidfile "/var/run/process.pid" start = "/usr/bin/php /var/www/voicealerts/process.php" stop = "/usr/bin/php /var/www/voicealerts/process.php"
Line 1 starts a process service entry. It contains the keyword check and a descriptive name for he process to monitor, in this case php. Monit also require the process pidfile to be stated.
If you want monit to start, stop or restart the process you must submit a start and stop program.
Line 2-3 defines those programs for this process
Write and quite the file and check the syntax is ok with command
sudo monit -t
start monit deamon by
sudo /etc/init.d/monit start
start the files specified in the monitrc by
sudo monit start all
check the status of our daemon
sudo monit status
This is a sample configuration monitors the PHP daemon process mentioned in the above post.

February 24th, 2010 2:51 am
sonic server is command line and also works on windows with the init.d
http://dev.pedemont.com/sonic