I'm working on RHEL 7.9. In my crontab, I have the following variables and command :
MAILTO=""
SHELL="/usr/bion/ksh"
30 * * * * find /home/me/data/input -name "*.completed" -size +10M -print >> /home/me/jobs/completed.big 2>/home/me/jobs/completed.big.errors
Since everyone has detected the extra o
in the SHELL var, you (and I) can tell that all jobs were failing silently.
The /var/log/cron
file was filled with all the expected command lines to run.
The journalctl -xe -t crond
command only mentioned reloading my personal cron and skipping jobs :
Jan 30 01:21:05 servername crond[26104]: (root) INFO (Job execution of per-minute job scheduled for 01:20 delayed into subsequent minute 01:21. Skipping job run.)
[...]
Feb 05 16:02:01 servername crond[3997]: (me) RELOAD (/var/spool/cron/me)
Seeing no logs from my jobs, I removed the MAILTO variable, and then the local mailbox of my account got messages like:
[... Stripping mail headers]
execl: couldn't exec `/usr/bion/ksh'
execl: No such file or directory
Since this error arrives before the command actually launches, I didn't get it in my job logs.
Is there any way to have these errors or at least trap that CRON failed to launch the command in a log ?We have enough mails here, and logs are already monitored.
I have read the Where are cron errors logged? question, but I would like to have a definitive answer on "Can crond errors be found elsewhere than the mails?". This might be a hidden configuration for crond, or anything else, I don't know.
At last, I might even consider tricking the mailbox to redirect into a log, and clean it afterwards.