Friday, 30 August 2013

Run a PHP script on server start

Run a PHP script on server start

I'm writing a PHP script (OK, it's a daemon worker) that I'd like to run
in the background, and it follows the following pseudo-code:
do {
// stuff
sleep(60*30); // 30 minutes
} while(1);
Now, how can I set this baby up to run automatically in the event that the
server gets restarted. I don't need to worry about state, since everything
is stored in the MySQL DB - and it should just be able to pick up right
where it left off.
I'm using an Ubuntu 12.04 x64 server, on AWS (if that matters).
Thanks!

No comments:

Post a Comment