CronTab

/ linux

File structure with tasks for CronTab:

* * * * * command
- - - - -
| | | | |
| | | | +----- Day (0 - 6) (Sunday=0)
| | | +------- Month (1 - 12)
| | +--------- Day of month (1 - 31)
| +----------- Hour (0 - 23)
+------------- Minute (0 - 59)

Sample

01 * * * * command - launch a program or script every hour in one minute

* 6 * * * command - launch a program or script each day at 6 o'clock in the morning

Values can be a number, three letters name, as well as a range such as "1-5" in the day field will mean "Monday through Friday.

Values can be separated by commas: "1,15,31" in the field day will run the specified command the 1st, 15th and 31th of each month.

All five time fields allow you to use "*", which refers to "use any valid value for this field.

To create jobs, use the commands listed below:

crontab -e - change your crontab file or creates a new

crontab -l - displays content of the existing crontab file

crontab -r - remove your crontab file

crontab -v - display the last time you changed your crontab file

Files with the tasks can be found here:

/usr/lib/cron - main catalog of commands associated with time

/usr/spool/cron/crontabs - catalog of files regular action

/usr/lib/cron/log - logs

/usr/lib/cron/cron.allow - users who are allowed to run the crontab

/usr/lib/cron/cron.deny - users who are banned to run the crontab

Next Post