Cron is an utility program which is a time-based job scheduler in Unix-like computer operating systems. It can also be combined with AWS Lambda to invoke function based on the time-scheduler.
CronJob is represented as space-delimited 5 character string. Here is the syntax:
+---------------- minute (0 - 59)
| +------------- hour (0 - 23)
| | +---------- day of month (1 - 31)
| | | +------- month (1 - 12)
| | | | +---- day of week (0 - 6) (Sunday=0 or 7)
| | | | | |- year
* * * * * * command to be executed
1. Running a job every minute:
* * * * * *
- This will run the job every minute.
2. Running a job every day:
0 0 * * * *
- This will run the job everyday at 00:00.
3. Running a job every monday at 07:00:
0 7 * * 1 *
- This will run the job every monday at 07:00.
4. Running a job every weekend at 10:00:
0 10 * * 0,6 *
- This will run the job every saturday and sunday at 10:00. 0
represents sunday and 6
represents saturday.