There are times when I need to create a clock that will run a script at a certain time or interval. Here's how to do it using crontab
.
This diagram explains how to set a timer.
* * * * * command to be executed
- - - - -
| | | | |
| | | | +----- day of week (0 - 6) (Sunday=0)
| | | +------- month (1 - 12)
| | +--------- day of month (1 - 31)
| +----------- hour (0 - 23)
+------------- min (0 - 59)
When you're ready to start your timer, run crontab
.
crontab -e
This will trigger every 6 hours.
0 6 * * * /path/to/shell/script
Subscribe to new posts
Processing your application
Please check your inbox and click the link to confirm your subscription
There was an error sending the email