5👍
First, I would probably configure cron to mail yourself any output by using MAILTO
:
In /etc/crontab:
MAILTO=username
Second, I usually add something to my script that (almost) cannot possibly fail, like the following:
#!/bin/sh
echo "$0 ran on `date +%c`" >> /tmp/crontab_test.log
# ... rest of program
If you’re calling a python script directly from cron, you could do something similar or create a wrapper shell script.
2👍
If you have sendmail installed, you can add the following to ‘/etc/aliases’
root: your_name@domain.com
After you do that, update the aliases running this command:
sudo newaliases
Cron will automatically email you every time a job is run. No need to specify that in the crontab file.
Also, make sure you test your email capabilities (e.g. make sure you are able to send emails from the server) and lastly, create a trivial cronjob and test if you receive an email.
Do not assume!
- [Django]-Django ORM – Grouped aggregates with different select clauses
- [Django]-How insecure is this?
- [Django]-Change label of a form field Django
- [Django]-How to get related model in template?
1👍
In addition to setting up cron to send email, you can send the output of cron to a seperate syslog log facility by adding the following to your /etc/syslog.conf
.
# Log cron stuff cron.* /var/log/cron.log
This should log a message to /var/log/cron.log each time a job is run.
- [Django]-TinyMCE popups not loading when using S3 and setting document.domain
- [Django]-Django giving error ImportError: No module named 'corsheaders'
- [Django]-Save ManyToMany with through intermediary class
- [Django]-How to configure code completion for Django based projects in PyDev?