|
1 | | -# cron-command |
| 1 | +# EasyEngine/cron-command |
| 2 | + |
| 3 | +Manages cron jobs in EasyEngine |
| 4 | + |
| 5 | +`cron` command contains following subcommand |
| 6 | + * [add](#add) |
| 7 | + * [update](#update) |
| 8 | + * [list](#list) |
| 9 | + * [delete](#delete) |
| 10 | + * [run-now](#run-now) |
| 11 | + |
| 12 | + ## add |
| 13 | + |
| 14 | + Adds a cron job to run a command at specific interval etc. |
| 15 | + |
| 16 | + ``` |
| 17 | + # Adds a cron job on example.com every 10 minutes |
| 18 | + $ ee cron add example.com --command='wp cron event run --due-now' --schedule='@every 10m' |
| 19 | + |
| 20 | + # Adds a cron job on example.com every 1 minutes |
| 21 | + $ ee cron add example.com --command='wp cron event run --due-now' --schedule='* * * * *' |
| 22 | + |
| 23 | + # Adds a cron job to host running EasyEngine |
| 24 | + $ ee cron add host --command='wp cron event run --due-now' --schedule='@every 10m' |
| 25 | + |
| 26 | + # Adds a cron job to host running EasyEngine |
| 27 | + $ ee cron add host --command='wp media regenerate --yes' --schedule='@weekly' |
| 28 | + ``` |
| 29 | + |
| 30 | + Also, refer to [possible schedule values](#possible-schedule-values) to know more about it. |
| 31 | + |
| 32 | + ## update |
| 33 | + |
| 34 | + Updates a cron job. |
| 35 | + |
| 36 | + ``` |
| 37 | + # Updates site to run cron on |
| 38 | + $ ee cron update 1 --site='example1.com' |
| 39 | + |
| 40 | + # Updates command of cron |
| 41 | + $ ee cron update 1 --command='wp cron event run --due-now' |
| 42 | + |
| 43 | + # Updates schedule of cron |
| 44 | + $ ee cron update 1 --schedule='@every 1m' |
| 45 | + ``` |
| 46 | + Also, refer to [possible schedule values](#possible-schedule-values) to know more about it. |
| 47 | + |
| 48 | + ## list |
| 49 | + |
| 50 | + Lists scheduled cron jobs. |
| 51 | + |
| 52 | + ``` |
| 53 | + Lists all scheduled cron jobs |
| 54 | + $ ee cron list --all |
| 55 | +
|
| 56 | + Lists all scheduled cron jobs of example.com |
| 57 | + $ ee cron list example.com |
| 58 | + ``` |
| 59 | + |
| 60 | + ## delete |
| 61 | + |
| 62 | + Deletes a cron job |
| 63 | + |
| 64 | + ``` |
| 65 | + # Deletes a cron jobs |
| 66 | + $ ee cron delete 1 |
| 67 | + ``` |
| 68 | + |
| 69 | + ## run-now |
| 70 | + |
| 71 | + Runs a cron job |
| 72 | + |
| 73 | + ``` |
| 74 | + # Runs a particular cron job |
| 75 | + $ ee cron run-now 1 |
| 76 | + ``` |
| 77 | + |
| 78 | +## possible schedule values |
| 79 | + |
| 80 | + We have helper to easily specify scheduling format: |
| 81 | + |
| 82 | +| Entry | Description | Equivalent To | |
| 83 | +| ---------------------- | ------------------------------------------ | ------------- | |
| 84 | +| @yearly (or @annually) | Run once a year, midnight, Jan. 1st | 0 0 1 1 * | |
| 85 | +| @monthly | Run once a month, midnight, first of month | 0 0 1 * * | |
| 86 | +| @weekly | Run once a week, midnight between Sat/Sun | 0 0 * * 0 | |
| 87 | +| @daily (or @midnight) | Run once a day, midnight | 0 0 * * * | |
| 88 | +| @hourly | Run once an hour, beginning of hour | 0 * * * * | |
| 89 | + |
| 90 | +You may also schedule a job to execute at fixed intervals, starting at the time it's added or cron is run. |
| 91 | +This is supported by following format: |
| 92 | + |
| 93 | +`@every <duration>` |
| 94 | + |
| 95 | +Where duration can be combination of: |
| 96 | + <number>h - hour |
| 97 | + <number>m - minute |
| 98 | + <number>s - second |
| 99 | + |
| 100 | + So `1h10m2s` is also a valid duration |
0 commit comments