Subject: Re: crontab
To: None <port-arm32@NetBSD.ORG>
From: Mark Brinicombe <amb@physig4.ph.kcl.ac.uk>
List: port-arm32
Date: 07/22/1996 13:10:22
>What is the file crontab good for ?
>
>I was looking for a file to manage my mail-fetching from our pop-server
>every 10 min (or so..) ..
>A friend using linux told me that at him it was crontab which did things
>like that, but I was a little confused when I looked into our crontab..
>
>So what file can be used to do that ?

crontabs are files that describe actions to be taken at certain times by cron
(The man page on cron(8) and crontab(1,5) should give more info).
In the crontab you can specify a command line etc to execute at set intervals
Each user can have their own cron tab. Cron checks every minute to see if there
are any command that need to be executed and then runs them with the uid
associated with crontab.

For example roots crontab has

0       2       *       *       *       /bin/sh /etc/daily 2>&1 | tee
/var/log/daily.out | mail -s "daily output" root
30      3       *       *       6       /bin/sh /etc/weekly 2>&1 | tee
/var/log/weekly.out | mail -s "weekly output" root
30      5       1       *       *       /bin/sh /etc/monthly 2>&1 | tee
/var/log/monthly.out | mail -s "monthly output" root

for running the daily script, weekly script and montly script

To run somthing every 10 minutes
you need an entry like

0-59/10       *       *       *       *       /bin/sh /script/to/run

i.e. every minute from 0 to 59 skipping 10 each time

or
0,10,20,30,40,50      *       *       *       *       /bin/sh /script/to/run

man 5 crontab will give you more info opn the format of the time specifiers
etc.

To read and write crontab files you should not edit the files in /var/cron/
directly but should use crontab

crontab -l

will list the crontab for the user running the command so the normal proceedure
is

crontab -l >crontab.mine	- get the current crontab for the user
vi crontab.mine			- edit it
crontab crontab.mine		- reinstall it.

Cheers,
				Mark

-- 
Mark Brinicombe				amb@physig.ph.kcl.ac.uk
Research Associate			http://www.ph.kcl.ac.uk/~amb/
Department of Physics			tel: 0171 873 2894
King's College London			fax: 0171 873 2716