nginx dead but pid file exists

Jonathan Matthews contact at
Sat Oct 20 12:00:54 UTC 2012

On 20 October 2012 12:36, nnttoo <nginx-forum at> wrote:
> Can I create a sh file that checks the status of nginx and run it with cron
> job? if nginx status becomes "dead", then the sh file is going to restart
> nginx. if it can, how to sample his sh file? and how examples of "cron job"?

If you're asking for example of how cron jobs work, I don't think
you're experienced enough to write scripts to monitor a daemon

Please look into "monit" instead, if indeed your VPS environment seems
to kill off processes like nginx randomly. Personally, I've never seen
this happen, but I'm sure there are situations in which it can.
Solutions like monit are a band-aid, and not a universal panacea.

Jonathan Matthews // Oxford, London, UK

More information about the nginx mailing list