FREESCO 0.3.x
ID #1196
What is the syntax of a crontab line?
A crontab line looks like this:
<?php |
An asterix at a location means a wildcard, so valid for all possible values. A value may contain a comma separated list (see example below). The five fields are separated by spaces. Cron is very picky about the syntax, so when something doesn't work, check your entries.
So an example could be:
<?php
0 0 * * * rc_httpd restart
?>
This will restart your web servers at midnight.
The next line:
<?php
*/5 * * * * /path/to/do_something.sh
?>
starts a shell script called do_something every 5 minutes.
This line
<?php
* * * * * /bin/date > /tmp/lastcron.txt
?>
will write the time and date to a log file every minute (the shortest cron interval) so you can verify crond is in fact running by looking at the timestamp in this file.
Finally here is an example of a comma separated value entry:
<?php
0 0 * * 1,3,5,7 /path/to/backup_script
?>
This line will execute a backup script @ midnight every other day, starting on Monday.
If you have a sendmail compatible mail server like exim installed on your FREESCO, then the root account will receive e-mails with the output of every cron entry that is executed. To avoid useless e-mails, you can redirect output- and error data to the /dev/null device, like so:
<?php
0 0 * * * /path/to/possibe_error >/dev/null 2>/dev/null
?>
Last update: 2005-05-04 10:18
Author: dingetje
Revision: 1.0
Print this record
Send to a friend
Show this as PDF file
Export as XML-File
You cannot comment on this entry