Reputation: 145
there is a process that always terminate abrutply, and is there anyway to monitor it? i dont want to end up manually typing "service named start" or service anyprocess start". i need a php script that checks a process on the server, then if its not running, it will run it. the process "named". also, how can we put a cron to it, like check evry 5 seconds? tnx
the pesudo code goes like this
check process if process is running do nothing else, if is not running execute "service anyprocess start"
check every 5 seconds.
Upvotes: 0
Views: 212
Reputation: 23216
The best thing would not be some home-grown PHP script, but a tested application that does this for you. There are many, but I am fond of Monit. It does exactly what you ask. Watch a daemon or program and if it fails, restart it.
Even better is that your daemon will be restarted immediately and not just whenever you put it in your cron.
Upvotes: 2