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

STEP ONE)

place file containing the python script you want to run in the web2py/applications/<name-of-your-web2py-application>/cron folder. For this example the file is named "crontest.py"; but you can give the file any name you wish.

Then upload the updated application to your rackspace VPS; if you are using a Windows based machine you may want to use an FTP application such as "WinSCP" (for example, http://winscp.net/eng/index.php)

STEP TWO)

log into your rackspace root account console; if you are using a Windows based machine you may want to download and use an application such as "PuTTY" (for example, http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html)

STEP THREE)

at the "root@<your-account-name>:~#" prompt, enter the command "crontab -e"

STEP FOUR)

hit the "down" arrow once, then enter:

*/1 * * * * python /home/www-data/web2py/web2py.py -S <name-of-your-web2py-application> -M -N -R applications/<name-of-your-web2py-application>/cron/crontest.py

then press "control-x" to exit and "Y" to save and "enter" to confirm the save

{begin note} replace "<name-of-your-web2py-application>" with the actual name of your web2py application (without the greater-than and less-than symbols) so for example, if the name of your web2py application is "tofu" then you'd enter

*/1 * * * * python /home/www-data/web2py/web2py.py -S tofu -M -N -R applications/tofu/cron/crontest.py

same convention applies for other similar notations in this web2py slice {end note}

Your CRON script should now be running once per minute. For other CRON settings, refer to the CRON syntax guide that can be found here: http://en.wikipedia.org/wiki/Cron

Cheers!

Related slices

Comments (1)


Hosting graciously provided by:
Python Anywhere