Skip to content

Commit 1a2b455

Browse files
committed
Merge branch 'kirtangajjar-update_readme' into develop
2 parents 7910f87 + 72a7913 commit 1a2b455

2 files changed

Lines changed: 108 additions & 8 deletions

File tree

README.md

Lines changed: 100 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,100 @@
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

src/Cron_Command.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,16 @@ public function __construct() {
5454
* <number>m - minute
5555
* <number>s - second
5656
*
57-
* So 1h10m2s is also a valid format
57+
* So 1h10m2s is also a valid duration
5858
*
5959
* ## EXAMPLES
6060
*
6161
* # Adds a cron job on example.com every 10 minutes
6262
* $ ee cron add example.com --command='wp cron event run --due-now' --schedule='@every 10m'
6363
*
64+
* # Adds a cron job on example.com every 1 minutes
65+
* $ ee cron add example.com --command='wp cron event run --due-now' --schedule='* * * * *'
66+
*
6467
* # Adds a cron job to host running EasyEngine
6568
* $ ee cron add host --command='wp cron event run --due-now' --schedule='@every 10m'
6669
*
@@ -139,7 +142,7 @@ public function add( $args, $assoc_args ) {
139142
* <number>m - minute
140143
* <number>s - second
141144
*
142-
* So 1h10m2s is also a valid format
145+
* So 1h10m2s is also a valid duration
143146
*
144147
* ## EXAMPLES
145148
*
@@ -278,9 +281,8 @@ private function generate_cron_config() {
278281
*
279282
* ## EXAMPLES
280283
*
281-
* # Lists all scheduled cron jobs
282-
* $ ee cron delete 1
283-
*
284+
* # Runs a cron job
285+
* $ ee cron run-now 1
284286
*
285287
* @subcommand run-now
286288
*/
@@ -304,9 +306,8 @@ public function run_now( $args ) {
304306
*
305307
* ## EXAMPLES
306308
*
307-
* # Lists all scheduled cron jobs
309+
* # Deletes a cron jobs
308310
* $ ee cron delete 1
309-
* TODO: Add relatable ID
310311
*
311312
*/
312313
public function delete( $args ) {

0 commit comments

Comments
 (0)