Hello,
So if you are not getting mail notification for /etc/cron.daily scripts, they are probably not being run by cron (as @CwF recalled in the previous post) or there is something wrong with your scripts or something wrong with your MTA.
Note that scripts in /etc/cron.daily/ must follow some naming and permission conventions that are listed in the cron man page [1]:
Hope this helps.
--
[1] cron - daemon to execute scheduled commands (Vixie Cron)
If I remember correctly, Debian's cron logs output from crontab and /etc/cron.daily/ scripts in the same way:[..]
anacron isn't installed
[..]
My question is: How to configure cron so that the behavior for scripts in cron.daily regarding logfiles is the same as for scripts in cron.d.
[..]
Where does the output from scripts in cron.daily go? It goes to nowhere. While for scripts in cron.d it goes to syslog...
- it logs an entry in the system journal (and /var/log/syslog, depending on the system configuration) that reports the execution of scripts like that (for /etc/cron.daily):
Code:
(root) CMD (test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ))
- then it sends a mail to root of each run-parts output (if any) with the output from the script; if the MTA (Mail Transfer Agent) is not installed, cron notifies it in the system journal/log; i.e.:where the test_script is:
Code:
From root@bullseye Sat Feb 01 08:55:01 2025Envelope-to: root@bullseyeDelivery-date: Sat, 01 Feb 2025 08:55:01 +0000From: root@bullseye (Cron Daemon)To: root@bullseyeSubject: Cron <root@bullseye> test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )MIME-Version: 1.0Content-Type: text/plain; charset=UTF-8Content-Transfer-Encoding: 8bitX-Cron-Env: <SHELL=/bin/sh>X-Cron-Env: <PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin>X-Cron-Env: <HOME=/root>X-Cron-Env: <LOGNAME=root>Date: Sat, 01 Feb 2025 08:55:01 +0000/etc/cron.daily/test_script:this is a test script for cron.daily
Code:
$ cat /etc/cron.daily/test_script #! /bin/bashecho "this is a test script for cron.daily"
So if you are not getting mail notification for /etc/cron.daily scripts, they are probably not being run by cron (as @CwF recalled in the previous post) or there is something wrong with your scripts or something wrong with your MTA.
Note that scripts in /etc/cron.daily/ must follow some naming and permission conventions that are listed in the cron man page [1]:
So check if these conventions are met, then check the contents of the scripts./etc/crontab and the files in /etc/cron.d must be owned by root, and must not be group- or other-writable. In contrast to the spool area, the files under /etc/cron.d or the files under /etc/cron.hourly, /etc/cron.daily, /etc/cron.weekly and /etc/cron.monthly may also be symlinks, provided that both the symlink and the file it points to are owned by root. The files under /etc/cron.d do not need to be executable, while the files under /etc/cron.hourly, /etc/cron.daily, /etc/cron.weekly and /etc/cron.monthly do, as they are run by run-parts (see run-parts(8) for more information).
Hope this helps.
--
[1] cron - daemon to execute scheduled commands (Vixie Cron)
Statistics: Posted by Aki — 2025-02-01 08:33