sys-fs/mdadm-3.3-r2 started installing checkarray from the debian patchset, and also added an entry to /etc/cron.d/ to run it. The format of the Debian-based mdadm.cron.d file breaks on (at least) dcron. The file contains: 57 0 * * 0 root if [ -x /usr/sbin/checkarray ] && [ $(date +\%d) -le 7 ]; then /usr/sbin/checkarray --cron --all --idle --quiet; fi ...But in dcron, /etc/cron.d/ files are always jobs run by root, so there is no field for the username. It looks to me like vixie cron (at least) does support the uername field in cron.d entries. Reproducible: Always Steps to Reproduce: 1. Use dcron as the cron daemon. 2. Upgrade to sys-fs/mdadm-3.3-r2 3. Get error emails once a week from cron Actual Results: Every week when the job runs, get this parse error email: Date: Sun, 08 Dec 2013 00:58:01 -0500 From: root <root@box> To: root Subject: cron for user root root if [ -x /usr/sbin/checkarray ] && [ $(date +\%d) -le 7 ]; then /usr/sbin/checkarray --cron --all --idle --quiet; fi /bin/sh: -c: line 0: syntax error near unexpected token `then' /bin/sh: -c: line 0: `root if [ -x /usr/sbin/checkarray ] && [ $(date +\%d) -le 7 ]; then /usr/sbin/checkarray --cron --all --idle --quiet; fi' Expected Results: The line should have parsed correctly, the if test should have executed properly, and either run or not run checkarray. I'm not sure what the correct fix is, except perhaps recreate this one-liner as a /etc/cron.weekly/ file, because those files' format do not depend on what cron daemon is in use (they just get executed by run-crons, or run-parts, or whatever). The /etc/cron.weekly/ file would be really really simple, and should accomplish exactly what the cron.d/ file does: #!/bin/sh if [ -x /usr/sbin/checkarray ] && [ $(date +\%d) -le 7 ]; then /usr/sbin/checkarray --cron --all --idle --quiet fi
should be all set now in the tree; thanks for the report! Commit message: Tweak cron.d entry to work for all crons http://sources.gentoo.org/sys-fs/mdadm/mdadm-3.3-r2.ebuild?r1=1.1&r2=1.2
(In reply to SpanKY from comment #1) This broke the cron.d file for cronie (and probably vixie as well). The username field is requried in a system cron job.
> This broke the cron.d file for cronie (and probably vixie as well). The > username field is requried in a system cron job. Argh, so different cron's have different syntaxies for /etc/cron.d/ entries? Sigh. Do you know if my alternate suggestion, turning it into a cron.weekly/ script, will work across those other crond's? (Assuming most/all crons supported by Gentoo include the moving parts to run /etc/cron.weekly/ scripts.)
Yes, I think cron.weekly will be fine. +*mdadm-3.3-r4 (12 Jul 2014) + + 12 Jul 2014; Mike Gilbert <floppym@gentoo.org> +files/mdadm.weekly, + +mdadm-3.3-r4.ebuild: + Replace cron.d file with a cron.weekly script, disabled by default. Bug + 493706.