Here's a solution I wrote. Is there a good place (like the web2py book) to 
share this recipe?

Put this in /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 friendbo
respawn

This assumes your web2py is in <user>'s home directory, running with 
permission <user>. Replace <user> with the right user id and change eth0 if 
your server uses a different network interface.

On Thursday, May 3, 2012 1:22:25 PM UTC-7, Michael Toomim wrote:
>
> Anyone have a recipe to make the scheduler run on boot? I'm using ubuntu. 
> Web2py is run in apache (using the recipe in the book), so I can't just use 
> the cron @reboot line.
>
> This is the line that needs to be run when my system boots:
>    python /home/web2py/web2py/web2py.py -K <appname>
>
> It seems ubuntu uses Upstart instead of sysvinit. And it might be possible 
> to tell Upstart to launch the scheduler WITH apache, using a line like "start 
> on started apache2" but I don't know how it works, and apache2 to use 
> upstart.
>
> It would be nice to have a recipe for the scheduler that we could add into 
> the book, to synchronize it with apache.
>

Reply via email to