Python Automation Cookbook
上QQ阅读APP看书,第一时间看更新

There's more...

If there's any problem in the execution of the crontab, you should receive a system mail. This will show up as a message in the Terminal, like this:

You have mail.
$

This can be read with mail:

$ mail
Mail version 8.1 6/6/93. Type ? for help.
"/var/mail/jaime": 1 message 1 new
>N 1 jaime@Jaimes-iMac-5K Thu May 17 21:15 19/914 "Cron <jaime@Jaimes-iM"
? 1
Message 1:
...
/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'cron.py': [Errno 2] No such file or directory

In the next recipe, we will see methods to capture the errors independently so that the task can run smoothly.