[olug] cron

Vincent vraffensberger at home.com
Thu Jul 20 22:15:01 UTC 2000


mesc wrote:
> 
> I'm still confused about cron,this is a line from my /etc/crontab
> file....15 * * * * * root /usr/bin/updatedb.......and this is a line
> generated from the file made when I enter the crontab -e command....15 *
> * * * root /usr/bin/updatedb my cron is not working for reasons which
> are probably obvious to you as you look at this.Do I need the
> min/day/month/etc in each file?The 15 in these files is by no means
> final I'm just trying to get  my cron working right first.Also I have 2
> books which differ on what each asterick   means pertaining to
> time/date.I've looked for the cron HOWTO with no luck so can  someone
> set me straight as to what time/date each asterick is?
> 
>                 Thank you,Gary Martin
> 
> ---------------------------------------------------------------------
15 * * * * /usr/bin/updatedb

Above is an example of a working line.  The five (not 6) positions are
for (left to right) minute - hour - day of month - month - day of
week(Sunday=0 Saturday=6).  These can be seperated, per field, by a
comma or a dash like I did below.

Here's a relatively complicated cronjob:
00,30 3,15 * 6-8 2-5 /root/bin/test.sh ; /usr/lib/sendmail -q >
/dev/null 2>&1

This line would run at 03:00, 03:30, 15:00 and 15:30, June through
August, Tuesday through Friday.  At these times it would run test.sh and
sendmail -q, redirecting all output to oblivion.  What follows the time
fields is just like any command line.

I think the trouble with your entries, from what you've quoted, is the
sixth time field and the "root" part.  

The easiest (and safest in my opinion) way to edit your crontab is to
run 'crontab -l" and redirect the output to a file.  Then edit that file
and do "crontab filename".  If you have trouble in your editor during a
crontab -e session it is possible to loose your work...  That really
sucks when you have 50 lines and no recent backup  :)

---------------------------------------------------------------------
To unsubscribe, e-mail: olug-unsubscribe at bstc.net
For additional commands, e-mail: olug-help at bstc.net



More information about the OLUG mailing list