4

I have a job that is run by anacron. In the syslog I see messages like:

Apr  6 06:11:09 host anacron[1031]: Job `myJob' terminated (mailing output)

but I never see that mail. If I run that same job through cron the output is mailed to /var/mail/username. Where is anacron mailing the output?

8

Most likely anacron is executing the jobs as root, so the mail isn't being sent to your user. You might what to use /etc/aliases to get the mail at your normal address. Like so:

root: your@email.com

Or to use a file:

root: /file/name

See man 5 aliases for more information.

| improve this answer | |
  • nice tip on using aliases and also on directing to a file – Joshua K Dec 26 '12 at 18:17
  • Does this file /etc/aliases exist on ubuntu xenial? – George Udosen Aug 5 '18 at 18:37
3

In case You use anacron on a home computer – one without a mail server installed –, You might want to see the logs (stdout) and errors (stderr) of your scheduled tasks in a log file for debugging. To do so, You can add redirections to your anacrontab file like this:

# period  delay  job-identifier  command
1         0      backup          /home/me/backup.sh 1>>/home/me/backup.log 2>>/home/me/backup-errors.log
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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