Put this into /etc/init/web2py-scheduler.conf:
description "web2py task scheduler" start on (local-filesystems and net-device-up IFACE=eth0) stop on shutdown # Give up if restart occurs 8 times in 60 seconds. respawn limit 8 60 exec sudo -u <user> python /home/<user>/web2py/web2py.py -K <appname> respawn
This assumes your web2py is installed in <user>'s home directory and runs under <user>'s account.
Replace eth0 if you use a different network interface on the server.
Your scheduler will launch automatically when you reboot your machine, or you can start/stop/restart/check the status of it manually with:
sudo start web2py-scheduler sudo stop web2py-scheduler sudo restart web2py-scheduler sudo status web2py-scheduler
...etc.
Comments (1)
0
jimkellas-57215 12 years ago
Nice! Now, how do I modify this Upstart script to start N number of task scheduler concurrently. I know the scheduler allows you to run multiple instances of it at the same time but I'd like a single script to start them all at once at startup.
Jim
replies (1)