Cron
Cron is a job-scheduling system utility on Unix and Unix-like operating systems. Users can schedule tasks, known as "cron jobs," to run automatically at set intervals. Most Unix users schedule cron jobs to carry out system maintenance tasks, like deleting log files and creating backups, but a user can schedule any command or script they find useful.
A user can schedule a cron job by creating a "crontab" file. A crontab file, or "cron table," specifies the command that will run and when to run it. A crontab file can contain a single cron job or multiple cron jobs. Each entry in a crontab has five variable fields that represent when to run the command, as well as one to specify the command itself:
1 2 3 4 5
* * * * * <command to run>
- The minute (0-59)
- The hour (0-23)
- The day of the month (1-31)
- The month (1-12)
- The day of the week (0-6, Sunday to Saturday)
Leaving an asterisk in place of a number runs the cron job at every instance of that variable. This allows the user to easily set a cron job to run every set number of minutes, hours, days, or months as necessary. Leaving every asterisk in place will run the cron job every minute.
For example, the following cron job will echo the phrase "hello world" at 3:30 AM on the first day of every month:
30 3 1 * * echo hello world