dpg76975 2011-07-27 13:25
浏览 132
已采纳

检查并运行进程的php代码

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.

  • 写回答

2条回答

  • douershuang7356 2011-07-27 13:42
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥50 如何增强飞上天的树莓派的热点信号强度,以使得笔记本可以在地面实现远程桌面连接
  • ¥15 MCNP里如何定义多个源?
  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 请问这个是什么意思?
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services