[CentOS] Quick crontab question (another cron question!)

Thu Jan 12 23:03:02 UTC 2006
Jose Alburquerque <jaalburquerque at cox.net>


Robert Hanson wrote:

>} 
>} Really quickly:  Would anyone know how I might add a crontab entry via a
>} script (bash)?  I'm attempting to write one to schedule commands at
>} certain times.  Is this possible?  Thanks.
>} 
>} -Jose
>
>if i remember right, i used to make cron looking text files and then as a
>non-root user you could test it by redirecting that file using the crontab
>command
>
>man crontab
>
>will show syntax
>  
>

You're right!  The man page says that crontab accepts an optional file 
argument (ie. crontab [-u user] file).  So if I do 'echo "30 18 12 1 * 
echo This text should be mailed to me at 6:30pm on 1/12" | crontab -', 
this will place that entry in crontab.  However, the entire previous 
crontab will be replaced by this single entry.  But thanks so much this 
really helps.  I'm sure I can now figure out a way to "append" to an 
already existent crontab using 'crontab -l', 'echo' or something of the 
sort.  Thanks again.

>after you test do a
>
>crontab -l
>
>will list show the entry if i remember right
>
>see if it puts it in the area you desire and modify your thinking and try
>again
>
>i was gonna test it for you and report back yet i dont think it would be too
>difficult regardless, apologies i dont have more time for it right at this
>moment
>
> - rh
>
> --
>Robert Hanson - Abba Communications
>   Computer & Internet Services
> (509) 624-7159 - www.abbacomm.net
>
>
>
>_______________________________________________
>CentOS mailing list
>CentOS at centos.org
>http://lists.centos.org/mailman/listinfo/centos
>
>  
>