[CentOS] Re: cat cron jobs into crontab

Karl R. Balsmeier karl at klxsystems.net
Tue Mar 13 18:35:43 UTC 2007

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 on.

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.

More information about the CentOS mailing list