cron

Execute Python script via crontab

Execute Python script via crontab Question: I’m trying to execute a Python script using the Linux crontab. I want to run this script every 10 minutes. I found a lot of solutions and none of them worked. For example: edit the anacron at /etc/cron.d or use crontab -e. I put this line at the end …

Total answers: 3

How to set virtualenv for a crontab?

How to set virtualenv for a crontab? Question: I want to set up a crontab to run a Python script. Say the script is something like: #!/usr/bin/python print “hello world” Is there a way I could specify a virtualenv for that Python script to run in? In shell I’d just do: ~$ workon myenv Is …

Total answers: 4

Cron and virtualenv

Cron and virtualenv Question: I am trying to run a Django management command from cron. I am using virtualenv to keep my project sandboxed. I have seen examples here and elsewhere that show running management commands from within virtualenv’s like: 0 3 * * * source /home/user/project/env/bin/activate && /home/user/project/manage.py command arg However, even though syslog …

Total answers: 20

How to run a script in the background even after I logout SSH?

How to run a script in the background even after I logout SSH? Question: I have Python script bgservice.py and I want it to run all the time, because it is part of the web service I build. How can I make it run continuously even after I logout SSH? Asked By: zihaoyu || Source …

Total answers: 12

How do I get a Cron like scheduler in Python?

How do I get a Cron like scheduler in Python? Question: I’m looking for a library in Python which will provide at and cron like functionality. I’d quite like have a pure Python solution, rather than relying on tools installed on the box; this way I run on machines with no cron. For those unfamiliar …

Total answers: 9