Skip to content

Commit

Permalink
Merge branch 'develop' for v1.0.0-beta.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mbtamuli committed Jul 23, 2018
2 parents 2a1b7c0 + 1a2b455 commit 34b27c0
Show file tree
Hide file tree
Showing 9 changed files with 556 additions and 1 deletion.
16 changes: 16 additions & 0 deletions .distignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.DS_Store
.git
.gitignore
.gitlab-ci.yml
.editorconfig
.travis.yml
behat.yml
circle.yml
bin/
features/
utils/
*.zip
*.tar.gz
*.swp
*.txt
*.log
25 changes: 25 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org

# WordPress Coding Standards
# https://make.wordpress.org/core/handbook/coding-standards/

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab

[{.jshintrc,*.json,*.yml,*.feature}]
indent_style = space
indent_size = 2

[{*.txt,wp-config-sample.php}]
end_of_line = crlf

[composer.json]
indent_style = space
indent_size = 4
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.DS_Store
wp-cli.local.yml
node_modules/
vendor/
*.zip
*.tar.gz
*.swp
*.txt
*.log
composer.lock
.idea
*.db
101 changes: 100 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,100 @@
# cron-command
# EasyEngine/cron-command

Manages cron jobs in EasyEngine

`cron` command contains following subcommand
* [add](#add)
* [update](#update)
* [list](#list)
* [delete](#delete)
* [run-now](#run-now)

## add

Adds a cron job to run a command at specific interval etc.

```
# Adds a cron job on example.com every 10 minutes
$ ee cron add example.com --command='wp cron event run --due-now' --schedule='@every 10m'
# Adds a cron job on example.com every 1 minutes
$ ee cron add example.com --command='wp cron event run --due-now' --schedule='* * * * *'
# Adds a cron job to host running EasyEngine
$ ee cron add host --command='wp cron event run --due-now' --schedule='@every 10m'
# Adds a cron job to host running EasyEngine
$ ee cron add host --command='wp media regenerate --yes' --schedule='@weekly'
```

Also, refer to [possible schedule values](#possible-schedule-values) to know more about it.

## update

Updates a cron job.

```
# Updates site to run cron on
$ ee cron update 1 --site='example1.com'
# Updates command of cron
$ ee cron update 1 --command='wp cron event run --due-now'
# Updates schedule of cron
$ ee cron update 1 --schedule='@every 1m'
```
Also, refer to [possible schedule values](#possible-schedule-values) to know more about it.

## list

Lists scheduled cron jobs.

```
Lists all scheduled cron jobs
$ ee cron list --all
Lists all scheduled cron jobs of example.com
$ ee cron list example.com
```

## delete

Deletes a cron job

```
# Deletes a cron jobs
$ ee cron delete 1
```

## run-now

Runs a cron job

```
# Runs a particular cron job
$ ee cron run-now 1
```

## possible schedule values

We have helper to easily specify scheduling format:

| Entry | Description | Equivalent To |
| ---------------------- | ------------------------------------------ | ------------- |
| @yearly (or @annually) | Run once a year, midnight, Jan. 1st | 0 0 1 1 * |
| @monthly | Run once a month, midnight, first of month | 0 0 1 * * |
| @weekly | Run once a week, midnight between Sat/Sun | 0 0 * * 0 |
| @daily (or @midnight) | Run once a day, midnight | 0 0 * * * |
| @hourly | Run once an hour, beginning of hour | 0 * * * * |

You may also schedule a job to execute at fixed intervals, starting at the time it's added or cron is run.
This is supported by following format:

`@every <duration>`

Where duration can be combination of:
<number>h - hour
<number>m - minute
<number>s - second

So `1h10m2s` is also a valid duration
28 changes: 28 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "easyengine/cron-command",
"description": "Manages cron jobs in EasyEngine",
"type": "ee-cli-package",
"homepage": "https://github.com/easyengine/cron-command",
"license": "MIT",
"authors": [],
"minimum-stability": "dev",
"prefer-stable": true,
"autoload": {
"psr-4": {
"": "src/"
},
"files": [ "cron-command.php" ]
},
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
},
"bundled": true,
"commands": [
"cron add",
"cron delete",
"cron list",
"cron run-now"
]
}
}
12 changes: 12 additions & 0 deletions cron-command.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

if ( ! class_exists( 'EE' ) ) {
return;
}

$autoload = dirname( __FILE__ ) . '/vendor/autoload.php';
if ( file_exists( $autoload ) ) {
require_once $autoload;
}

EE::add_command( 'cron', 'Cron_Command' );
2 changes: 2 additions & 0 deletions ee.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
require:
- cron-command.php
Loading

0 comments on commit 34b27c0

Please sign in to comment.