What's a good strategy to restart downed FastCGI processes automatically?
-
22-09-2019 - |
Question
I've got a Perl based FastCGI app that rarely goes down. However, when it does go down, the restart is not automatic. Restarting Apache manually always does the trick but that does address improving the uptime of the app.
I'm thinking of using a cron
job in conjunction with a script that uses WWW::Mechanize
to periodically check on the app and restart it as required, as suggested by the folks at Perl Monks :
Keep FastCGI Processes Up and Running
Before I do that, I'm want to know if anyone knows of better ways to monitor a FastCGI process and restarting it automatically when it dies, or is the method suggested above the optimal one?
Thanks.
Solution
Monit is a nice monitoring daemon that can do automatic restarts and/or notification.
OTHER TIPS
How about not having the process supervised by Apache but using an mechanism similar to the way init(8)
starts getty
processes? I have found daemon
to be quite useful.
Most of the web servers offer already offer this as a configuration option.