• Post Reply Bookmark Topic Watch Topic
  • New Topic

Some cron/crontab stuff  RSS feed

 
George Brown
Ranch Hand
Posts: 919
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thought some cron info may be handy...
you usually control cron from the crontab command with one of 3 options:
crontab -e -- edit the crontab file for the invoking user
crontab -l -- list the contents of your current crontab file
crontab -r -- remove your current crontab file
the options are:
crontab [filename]
or
crontab [-elr] [username]
(omitting the username defaults to the current user)
A crontab file consists of lines of six fields each. The fields are separated by spaces or tabs. The first five are integer patterns that specify the following:
minute (0-59),
hour (0-23),
day of the month (1-31),
month of the year (1-12),
day of the week (0-6 with 0=Sunday).
Each of these patterns may be either an asterisk (meaning all legal values) or a list of elements separated by commas.
so an example would be:
15 7 * * 1-5 java BatchMailer emails.txt msg.txt george@javaranch.com
which would mean: execute the command specified (send some emails) on days 1-5 (monday to friday) at 7:15 am regardless of the day or month.
or another example...
0 12 25 12 * mail george < xmas.txt
would mean 'mail that xmas greeting to george on Dec 25th at midday'
Any line containing a '#' character is a comment to the end of the line.
The actual files that cron uses will vary slightly between unix flavours. For example, under linux the files might sit in /var/cron/tabs. But they would sit in /var/spool/cron/crontabs under Solaris.
[This message has been edited by George Brown (edited November 21, 2000).]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!