"/usr/sbin/run-crons" will be used in "/etc/crontab" from "sys-process/fcron[system-crontab]" (last tested with "fcron-3.1.2-r2") to call the scripts within "/etc/cron.{hourly,daily,weekly,monthly}". Currently, there is no way to detect a failure. For example if "/etc/cron.hourly/foo" will fail (=end with non-zero exit code) you won't notice. Solutions like "run-parts" from "sys-apps/debianutils" will end with a non-zero exit code when any executed script has failed. The attached patch would add the same functionality to "run-crons".
Created attachment 363450 [details, diff] indicate script errors with exit code The attached patch will set a non-zero exit code when a called script will fail, so "run-crons" will indicate a problem with the exit code.
what is this good for exactly ?
Thought that comment #0 was clear about that: When a cronjob fails it should indicate that failure using exit codes. This allows cron to pick up this information and react based on user's settings. Currently we don't honor exit codes from scripts in "/etc/cron.{hourly,daily,weekly,monthly}". So any cronjob which is installed into one of these folders and which is failing will be "under the radar" - the user won't be notified by cron. The patch will change that: 1. We will now honor exit codes. That will allow cron to report errors (if the user don't want that, the user can always turn that off) for failing scripts in "/etc/cron.{hourly,daily,weekly,monthly}". 2. If you check other distributions like RHEL or Debian you will notice that these distributions are already honoring exit codes from scripts in "/etc/cron.{hourly,daily,weekly,monthly}". So this change will make sure that Gentoo keeps up with Linux' defaults.
(In reply to Thomas D. from comment #3) the confusion is that your patch doesn't really achieve your stated goals. when run-crons exits non-zero, an e-mail will be generated saying just that: run-crons exited non-zero. but it won't tell you which script exactly failed. remember that any invocation of `run-crons` is allowed to run any of the /etc/cron.*/* scripts. i've updated run-crons to exit non-zero but also utilize syslog with the full name of the failing script: Jul 22 03:02:10 [run-crons] CMD (/etc/cron.hourly/foo) failed with exit status 1 the generated e-mail is still mostly useless, but that can be handled in bug 540274.
should be all set now in the tree; thanks for the report! Commit message: When any script fails, log the failure explicitly in case the job itself produced no output, and exit non-zero so higher levels can detect and take action http://sources.gentoo.org/sys-process/cronbase/cronbase-0.3.5.ebuild?rev=1.1 http://sources.gentoo.org/sys-process/cronbase/files/run-crons-0.3.5?rev=1.1