How to set virtualenv for a crontab?

Is there something equivalent I could do in crontab to activate a virtualenv? This works well for me… ## call virtualenv python from crontab 0 9 * * * /path/to/virtenv/bin/python /path/to/your_cron_script.py I prefer using python directly from the virtualenv instead of hard-coding the virtualenv $PATH into the script’s shebang… or sourcing the venv activate

Debugging crontab jobs

You can enable logging for cron jobs in order to track problems. You need to edit the /etc/rsyslog.conf or /etc/rsyslog.d/50-default.conf (on Ubuntu) file and make sure you have the following line uncommented or add it if it is missing: cron.* /var/log/cron.log Then restart rsyslog and cron: sudo service rsyslog restart sudo service cron restart Cron … Read more