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?
Akemi
Dropping a script into cron.d is the safer way of scripting a cron job. You are less likely to damage something if a script errs.
The most common way I have seen ov updating crontab is the crontab command.
1. login or su to the appropriate user 2. crontab -l > /tmp/crontab.txt 3. edit /tmp/crontab.txt to your liking 4. crontab /tmp/crontab.txt
This gets the right files in the right places an alerts cron of the change.
Bob Styma