crontab Linux Commands
What is Linux crontab Command?
Explanation
crontab COMMAND:crontab command is used to add cron jobs to cron table.
Those jobs are nothing but programs that will run at scheduled time intervals automatically.
SYNTAX :
crontab [-u user] file [options]
OPTIONS:
-u |
It specifies the name of the user whose crontab is to be tweaked. |
-l |
The current crontab will be displayed on standard output. |
-r |
The current crontab will be be removed. |
-e |
This option is used to edit or create cron jobs. |
-i |
This option modifies the -r option to prompt the user for a 'y/Y' response before actually removing the crontab. |
EXAMPLE:
-
crontab -e
Output:
*/10 12 * * Mon /bin/sh /home/root/bin/server-backup
~
~
here,
*/10 - minutes
12 - hour
* - day of month
* - month of year
Mon - day of week
The command on execution will list all the cron jobs that already exists. You can either edit or add a new cron job to the table.
In the above example, The cronjob 'server-backup' will be running every Monday at 12th hour for every 10 minutes.