Search code examples
pythondeploymentweb2pyproduction-environment

running web2py scheduler in production


I know that I can run the scheduler manually by using

python web2py.py -K myapp

But where should this be specified in production environment? I am using standard web2py deployment script for apache, on ubuntu.


Solution

  • With Ubuntu 12.04 I make it manually:

    1. in /etc/init directory create web2py-scheduler.conf file:

      description     "Web2py scheduler"
      start on filesystem or runlevel [2345]
      stop on runlevel [!2345]
      
      respawn
      respawn limit 8 60
      
      exec sudo -u user <path_to_web2py>/web2py.py -K <your_app>
      
    2. in /etc/init.d exec:

      ln -s /lib/init/upstart-job web2py-scheduler

    3. (optional, only if you want manual startup) in /etc/init directory create the web2py-scheduler.override file:

      manual