Running A Daemon Script Forever from marko's blog

So you have a php script you wish to keep running forever


Create bash file - runsForever.sh

#!/bin/sh

ps aux | grep '[d]aemon.php'

if [ $? -ne 0 ]

then

    php /home/acct/public_html/daemon.php

fi



Create a cron job for every minute

* * * * * /bin/sh runsForever.sh


or run it this way on CLI: 
nohup /bin/sh runsForever.sh &


But when the system reboots, it is gone


Share:
Previous post     
     Blog home

The Wall

No comments
You need to sign in to comment

Post

By marko
Added Nov 20 '19

Tags

Rate

Your rate:
Total: (0 rates)

Archives