[CentOS] cat cron jobs crontab: SOLVED
Karl R. Balsmeier
karl at klxsystems.net
Tue Mar 13 19:25:35 UTC 2007
so to script the thing it's actually done like this, doh:
#show crontab, on a new system should be empty:
#put in whatever cron checks you need, one by one...
echo "*/3 * * * * /usr/lib64/nagios/plugins/check_megaraid_passive.sh >
/dev/null 2>&1" >> /var/spool/cron/root
# restart crond afterward
service crond restart
# show you results, new stuff should be there.
dunno why I was trying to do this elaborate EOF thing.
Karl R. Balsmeier wrote:
> thanks, I'm running a script after kickstart install, and am looking
> to "cat" a known value into an empty cron file. Managing it or
> otherwise having to manually edit it is not the issue i'm seeking info
> I'm trying to avoid having to manually add all of my known cron jobs
> with crontab -e
> To do this, I was trying out some stuff like:
> *cat >> $out_file << EOF
> first line of data
> second line of data
> more data
> the end of the data
> but in a way that was safe for cron, with no modifications to the
> default manner in which cron runs, e.g. crontab -l, crontab -e later
> would not break seeking some new file.
> Matt Hyclak wrote:
>> On Tue, Mar 13, 2007 at 11:32:55AM -0500, Styma, Robert E (Robert)
>> enlightened us:
>>> 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.
>> Or you could just type crontab -e and not copy tmp files around.
>> This method is fine when you're not trying to automate something, so
>> is good
>> information, but less useful to the OP.
> CentOS mailing list
> CentOS at centos.org
More information about the CentOS