I have a python script running by cron. For what ever reason, it is not running. I am wondering if there is anywhere that error messages are sent? Script runs fine by itself. If I run a simple script with crontab, that just writes to a file that works also.

My crontab is:

*/15 * * * * python ./home/pi/foo/bar.pyw
  • 1
    Ok, I figured out the issue with my script. I was calling modules which were in the same directory as the bar.pyw script. I changed the working directory with os.chdir("some location"). I still however would like to know where the error messages go for crontabs
    – Richard
    Nov 26, 2012 at 19:46

2 Answers 2


By default, the logging for the cron daemon is not enabled in Debian (I assume it is the system you are using). To enable it, please open the file /etc/rsyslog.conf via

$ vi /etc/rsyslog.conf

and uncomment the line

# cron.*                          /var/log/cron.log

After that, you need to restart rsyslog via

$ /etc/init.d/rsyslog restart

and you will find the cron logs in /var/log/cron.log

Source: Enable crontab logging in Debian Linux

  • 1
    Alf: Thank you for your reply. I have now implemented cron logging and have alter the command in my crontab to [Code] */3 * * * * /usr/bin/sudo -H /home/pi/ahbc [/code] The sudo -H is something I found on the web which I am told works. I don't understand just what the -H is there for. I have been given to understand that if one does not include the uservin a crontab command line that command will run using the user/owner of crontab. Therefore as my crontab is user pi crontab the contained commands will run for pi.
    – Bex
    Jan 12, 2015 at 7:42
  • the link is broken now :(
    – Michael
    Jun 8, 2015 at 20:27
  • @Michael The explanation here should be enough to achieve logging. Do you need something else? Jun 8, 2015 at 21:43
  • 2
    @ElanHasson Anything that generates extra writes to the SD card and is a low priority is generally disabled on the rPi.
    – SiKing
    Dec 2, 2016 at 16:39
  • I've just posted an edit request for the link, it looks like the source site just changed it's setup a bit.
    – Kioshiki
    Jan 22, 2017 at 14:53

Crontab has several parameters (in additional to time execution lines) For example:

MAILTO="[email protected]"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.