From ace09a9c9b4b0eb27859e1fa9b9831043907ae98 Mon Sep 17 00:00:00 2001 From: Kostyantyn Moroz Date: Mon, 14 Mar 2016 19:25:51 +0000 Subject: [PATCH 1/3] Added format of crontab file --- pages/common/crontab.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pages/common/crontab.md b/pages/common/crontab.md index 6d4faa75e3..51dc7204ee 100644 --- a/pages/common/crontab.md +++ b/pages/common/crontab.md @@ -13,3 +13,16 @@ - Remove all cron jobs for the current user: `crontab -r` + +- Configuration file: + +``` +# ┌───────────── min (0 - 59) +# │ ┌────────────── hour (0 - 23) +# │ │ ┌─────────────── day of month (1 - 31) +# │ │ │ ┌──────────────── month (1 - 12) +# │ │ │ │ ┌───────────────── day of week (0 - 6) (0 to 6 are Sunday to Saturday, or use names; 7 is Sunday, the same as 0) +# │ │ │ │ │ +# │ │ │ │ │ +# * * * * * command to execute +``` From 3c00a0d18012a7a03b8e55a5b7c2f9ab0c5304bd Mon Sep 17 00:00:00 2001 From: Agniva De Sarker Date: Wed, 7 Sep 2016 23:10:11 +0530 Subject: [PATCH 2/3] cron: Add job definition example --- pages/common/crontab.md | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/pages/common/crontab.md b/pages/common/crontab.md index 51dc7204ee..236964c524 100644 --- a/pages/common/crontab.md +++ b/pages/common/crontab.md @@ -14,15 +14,18 @@ `crontab -r` -- Configuration file: +- Cron job definition format: -``` -# ┌───────────── min (0 - 59) -# │ ┌────────────── hour (0 - 23) -# │ │ ┌─────────────── day of month (1 - 31) -# │ │ │ ┌──────────────── month (1 - 12) -# │ │ │ │ ┌───────────────── day of week (0 - 6) (0 to 6 are Sunday to Saturday, or use names; 7 is Sunday, the same as 0) -# │ │ │ │ │ -# │ │ │ │ │ -# * * * * * command to execute -``` +`{{minute}} {{hour}} {{day_of_month}} {{month}} {{day_of_week}} {{command_to_execute}}` + +- Sample job which runs at 10:00 every day. * means any value: + +`0 10 * * * {{path/to/script.sh}}` + +- Sample job which runs every minute on the 3rd of April: + +`* * 3 4 * {{path/to/script.sh}}` + +- Sample job which runs at 02:30 every friday: + +`30 2 * * 5 {{path/to/script.sh}}` From 835c4a3e49ca7d4597f57a86567ff2dbaae030af Mon Sep 17 00:00:00 2001 From: Agniva De Sarker Date: Thu, 8 Sep 2016 15:07:36 +0530 Subject: [PATCH 3/3] cron: Use day/month names instead of nos. --- pages/common/crontab.md | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/pages/common/crontab.md b/pages/common/crontab.md index 236964c524..d907bd4bad 100644 --- a/pages/common/crontab.md +++ b/pages/common/crontab.md @@ -1,6 +1,7 @@ # crontab > Schedule cron jobs to run on a time interval for the current user. +> Job definition format: "(min) (hour) (day_of_month) (month) (day_of_week) command_to_execute". - Edit the crontab file for the current user: @@ -14,18 +15,14 @@ `crontab -r` -- Cron job definition format: - -`{{minute}} {{hour}} {{day_of_month}} {{month}} {{day_of_week}} {{command_to_execute}}` - - Sample job which runs at 10:00 every day. * means any value: `0 10 * * * {{path/to/script.sh}}` - Sample job which runs every minute on the 3rd of April: -`* * 3 4 * {{path/to/script.sh}}` +`* * 3 Apr * {{path/to/script.sh}}` -- Sample job which runs at 02:30 every friday: +- Sample job which runs at 02:30 every Friday: -`30 2 * * 5 {{path/to/script.sh}}` +`30 2 * * Fri {{path/to/script.sh}}`