If you benefit from web2py hope you feel encouraged to pay it forward by contributing back to society in whatever form you choose!

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>

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


Related slices

Comments (1)

  • Login to post

  • 0
    jimkellas-57215 9 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.



    replies (1)
    • toomim 9 years ago

      I think you can edit line 9 to use -K <appname>,<appname>,<appname>. If you try this out can you report back?

Hosting graciously provided by:
Python Anywhere