:: [DNG] [SOLVED] Problem with cron-jo…
Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Walter Dnes
Ημερομηνία:  
Προς: Devuan list
Αντικείμενο: [DNG] [SOLVED] Problem with cron-job emails
No email this morning. The "ugly hack" solution was to change the
crontab to...

30 03 * * * /root/bin/bkup >/dev/null 2>&1

...no output means no email. Hoorah!

Now on to *THE ROOT CAUSE* of my problems. Someone pointed out to me
offline that *IF ANACRON IS INSTALLED*, then it handles all
daily+weekly+monthly jobs, as per /etc/crontab

> 17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
> 25 6    * * *   root    test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.daily; }
> 47 6    * * 7   root    test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.weekly; }
> 52 6    1 * *   root    test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.monthly; }


cron still handles hourly jobs. The reason for this split is
explained in the answer at...

https://superuser.com/questions/1332092/why-is-the-cron-hourly-line-in-etc-crontab-the-only-one-without-test-x-u

tldr; it is much easier to write reliable code for date without hour
than for date with hour. The anacron authors took the easy way out.
Because anacron handles "MAILTO" differently, I was wasting my time
reading "man cron" instead of "man anacron".

Question: is anyone running cron without anacron, and does it work for
daily jobs, etc? I.e. can I uninstall anacron? My current setup...
#############
[dev2][waltdnes][~] apt list --installed | grep -i cron

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

anacron/stable,now 2.3-36 amd64 [installed,automatic]
cron-daemon-common/stable,now 3.0pl1-162 all [installed]
cron/stable,now 3.0pl1-162 amd64 [installed]

--
Walter Dnes <waltdnes@???>
There are 2 types of people in this world
1) Those who can extrapolate from incomplete data