开发者

php code that checks and run process

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 i开发者_运维百科s running do nothing else, if is not running execute "service anyprocess start"

check every 5 seconds.


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.


Don't do this in PHP use Monit instead.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜