How to check if a php script is still running

前端 未结 13 2461
鱼传尺愫
鱼传尺愫 2020-12-15 12:02

I have a PHP script that listens on a queue. Theoretically, it\'s never supposed to die. Is there something to check if it\'s still running? Something like

13条回答
  •  有刺的猬
    2020-12-15 12:49

    troelskn wrote:

    Just append a second command after the script. When/if it stops, the second command is invoked. Eg.:

    php daemon.php | mail -s "Daemon stopped" you@example.org
    

    This will call mail each time a line is printed in daemon.php (which should be never, but still.)

    Instead, use the double ampersand operator to separate the commands, i.e.

    php daemon.php & mail -s "Daemon stopped" you@example.org
    

提交回复
热议问题