Skip to content

Commit 34b27c0

Browse files
committed
Merge branch 'develop' for v1.0.0-beta.1
2 parents 2a1b7c0 + 1a2b455 commit 34b27c0

9 files changed

Lines changed: 556 additions & 1 deletion

File tree

.distignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.DS_Store
2+
.git
3+
.gitignore
4+
.gitlab-ci.yml
5+
.editorconfig
6+
.travis.yml
7+
behat.yml
8+
circle.yml
9+
bin/
10+
features/
11+
utils/
12+
*.zip
13+
*.tar.gz
14+
*.swp
15+
*.txt
16+
*.log

.editorconfig

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# This file is for unifying the coding style for different editors and IDEs
2+
# editorconfig.org
3+
4+
# WordPress Coding Standards
5+
# https://make.wordpress.org/core/handbook/coding-standards/
6+
7+
root = true
8+
9+
[*]
10+
charset = utf-8
11+
end_of_line = lf
12+
insert_final_newline = true
13+
trim_trailing_whitespace = true
14+
indent_style = tab
15+
16+
[{.jshintrc,*.json,*.yml,*.feature}]
17+
indent_style = space
18+
indent_size = 2
19+
20+
[{*.txt,wp-config-sample.php}]
21+
end_of_line = crlf
22+
23+
[composer.json]
24+
indent_style = space
25+
indent_size = 4

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.DS_Store
2+
wp-cli.local.yml
3+
node_modules/
4+
vendor/
5+
*.zip
6+
*.tar.gz
7+
*.swp
8+
*.txt
9+
*.log
10+
composer.lock
11+
.idea
12+
*.db

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

composer.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"name": "easyengine/cron-command",
3+
"description": "Manages cron jobs in EasyEngine",
4+
"type": "ee-cli-package",
5+
"homepage": "https://github.com/easyengine/cron-command",
6+
"license": "MIT",
7+
"authors": [],
8+
"minimum-stability": "dev",
9+
"prefer-stable": true,
10+
"autoload": {
11+
"psr-4": {
12+
"": "src/"
13+
},
14+
"files": [ "cron-command.php" ]
15+
},
16+
"extra": {
17+
"branch-alias": {
18+
"dev-master": "1.x-dev"
19+
},
20+
"bundled": true,
21+
"commands": [
22+
"cron add",
23+
"cron delete",
24+
"cron list",
25+
"cron run-now"
26+
]
27+
}
28+
}

cron-command.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
if ( ! class_exists( 'EE' ) ) {
4+
return;
5+
}
6+
7+
$autoload = dirname( __FILE__ ) . '/vendor/autoload.php';
8+
if ( file_exists( $autoload ) ) {
9+
require_once $autoload;
10+
}
11+
12+
EE::add_command( 'cron', 'Cron_Command' );

ee.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
require:
2+
- cron-command.php

0 commit comments

Comments
 (0)