On Mon, Mar 12, 2007 at 06:58:44PM -0700, Akemi Yagi enlightened us:
On Mon, Mar 12, 2007 at 05:21:47PM -0800, Karl R. Balsmeier enlightened us:
What's the best/safest way to "cat" the following job into crontab?
*/3 * * * * /usr/lib64/nagios/plugins/check_megaraid_passive.sh > /dev/null 2>&1
I am used to doing this manually via crontab -e, but now I simply have too many centos servers to build in a given week (get to toss another 120K at some more 2U chenbro/tyan/amd64's -w000ooo).
echo '*/3 * * * * /usr/lib64/nagios/plugins/check_megaraid_passive.sh > /dev/null 2>&1' > /etc/cron.d/check_megaraid_passive.sh
(Watch for wrapping, of course).
Matt
Isn't this supposed to be written to /etc/crontab (if root) or to /var/spool/cron/username (if a user) ? Or maybe I am mistaken?
You could, and then the next time cron is updated you either have /etc/crontab overwritten by the new one, or you get a .rpmnew with important changes that you are now missing.
Putting a file in /etc/cron.d is probably a better solution. Even better than the echo command above would be to create the file in an RPM that can then get distributed via your favorite package updater.
Matt