Cron is a built in Linux utility that allows you to schedule jobs called cron jobs. You can schedule cron jobs to run hourly, daily, weekly, monthly, yearly or any sort of variation in between. Cron is configured through a specialized text interface called the crontab. The problem is that the Crontab format is a little confusing until you become acclimated to scheduling out jobs. Let’s take a look:
Each * represents a time slot. Using the table below you can see that each * represents varying measurements of time:
|Minute||Hour||Day of the month (1-31)||Month (1-12)||Day of the week (0 - 6 where 0 = Sunday)|
crontab format examples
Note: cron uses a 24 hour clock ie military time.
Schedule a job to run once a day at 2:00am:
Schedule a job to run at the 1st of the month:
Schedule a job to wish the system a merry christmas:
Clear the temp files once a week on Friday after everyone has left work:
Is it all coming together now? Practice some examples of your own to really get the hang of it. Pretty soon you will be using anything as an excuse to bust out your crontab for a quick scheduling. Let me know in the comments if you need help.