Some quick info about cron and how to setup jobs etc..

crontab -e Edit your crontab file, or create one if it doesn’t already exist. Each user has their own cron jobs they can setup and specify. There is not just one crontab for all users on the machine.
crontab -l Display your crontab file.
crontab -r Remove your crontab file.

Each entry in a crontab file consists of six fields, specifying in the following order:
minute(s) hour(s) day(s) month(s) weekday(s) command(s)

The fields are separated by spaces or tabs. The first five are integer patterns and the sixth is the command to execute. The following table briefly describes each of the fields:

Field Value Description minute 0-59 The exact minute that the command sequence executes hour 0-23 The hour of the day that the command sequence executes day 1-31 The day of the month that the command sequence executes month 1-12 The month of the year that the command sequence executes weekday 0-6 The day of the week that the command sequence executes (Sunday = 0, Monday = 1, Tuesday = 2, and so forth) command Special The complete sequence of commands to execute. The command string must conform to Bourne shell syntax. Commands, executables (such as scripts), or combinations are acceptable.

Crontabs for individual users are in /var/spool/cron/crontabs
crontabs for services are located in /etc/cron.d

To get started, basically type crontab -e, your crontab file will open in your default editor (vi or nano) and you can add your lines.
Here’s mine…

#zomg a comment 13 4 * * * /etc/webmin/cron/tempdelete.pl #Delete Webmin temporary files 0 0 * * 0 /usr/sbin/ntpdate time.mtu.edu

Blog Logo

Mario Loria


Published

Image

./scriptthe.net

Because 127.0.0.1 gets old after a while.

Back to Overview