I have a PHP script that has been running as a cron job. The script uses the DB to see if it has anything to do, and to make sure its brethren are not already running.
I'd like to run the PHP script as a daemon with upstart.
I've set up my /etc/init/super-mailer.conf
file as this:
description "super mailer"
author "Rob Nugen"
start on startup
stop on shutdown
respawn
exec sudo -u www-data php -f /var/www/super-mailer/scripts/mailer.php
I execute sudo start super-mailer
and it runs once.
It doesn't run again, though. Why not?
I've also tried replacing the exec sudo
line with
script
sudo -u www-data php -f /var/www/clubberia-mailer/scripts/mailer.php
end script
Do I need to change my PHP script to loop? How do I tell upstart to keep starting the script?