Cronjobs - An effective Linux utility
Cron, an Unix term stands for Command Run ON. It is very useful utility in Unix/Linux specially for SysAdmins who might like to schedule different tasks on different times for different purposes.
Most frequently it is used for running scripts and creating backups. It’s a command based utility, where we can schedule a task on a given time to run. It’s format looks like the following:
MIN HOUR DOM MON DOW CMD
MIN = Minutes[0-59] , HOUR = Hour[0-23] , DOM = Day of month[1-31] , MON = Month[1-12] , DOW = Day of week[0-6] , CMD = Command to run
00 06 * * * /home/bak/cback.sh
The above command will run on the following time and will trigger a script at home bak directory called cback.sh:
00 = 0th minute
06 = 6AM at morning
* = Every day
* = Every month
* = Every day of the week
* represents Every word here, if you want to run it every hour. Replace 06 with *, which will trigger the script every hour.
You can see the cron jobs by running
crontab -l in terminal and add/edit them via
Read Linux man pages in terminal for more knowledge or read this article for more deep understanding.