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

Tags

Rate

Your rate:
Total: (0 rates)

Archives

Blogs

marko
So you have a php script you wish to keep running ... more
marko Nov 20
Bankole Ahmed
PHP Introduc tion First of all before we start the... more
marko
The best way to start is to do this: sudo port li... more
marko Nov 6