Amazing, amazing guide through. Not only I know much more about Monit now, I have also learned the daemon processes with your help as well. So, thank you very much.
I have changed the PID file to point to /var/run/holdreport.pid and added `status` as well to my daemon which works beautifully. I also change the awaken section to 20 for 20 seconds but left the delay to 60 so that if the computer is restarted it waits until chkconfig runs my program and then it start monitoring.
Few problems I am encountering now:
1- Tailing the /var/log/monit.log file doesn't show me anything if I kill the
holdreport.pl process. I waited the 20 seconds required but I don't see any logs generated in /var/log/monit.log and also the program didn't re-spawn. Here is what I have in /etc/monit.d/monitrc
# Start monitrc
set daemon 5 with start delay 5
set logfile /var/log/monit.log
set httpd port 2812 and
allow localhost
allow 172.16.0.6 # I insert my home IP here
allow <username>:<password>
check process holdreport with pidfile /var/log/holdreport.pid
#group Reports
start program = "/etc/init.d/holdreport start"
stop program = "/etc/init.d/holdreport stop"
if 5 restarts within 5 cycles then timeout
# EOF
2- Can't get access to the httpd page at :2812 because I can't authenticate. Where is the actuall username/pass defined? Are these apache htapsswd file username and passwords or could it be just plain username:passsword format and then use "username" and "password" for authentication?
3- Multiple instances - There is a chance that my file might run in multiple instances and if it does it can duplicate all of it's reports which is not desireable. I guess I have to do an "if condition" in my start scrip to make sure another instance is not running? or is there something in monit that can check for other instances of the program?
Regards,