easyengine/cron-command

Manages cron jobs in EasyEngine

Installs: 20 371

Dependents: 1

Suggesters: 0

Security: 0

Stars: 4

Watchers: 5

Forks: 8

Open Issues: 10

Type:ee-cli-package

v2.0.1 2023-11-10 10:42 UTC

README

Manages cron jobs in EasyEngine

Quick links: Using | Contributing | Support

Using

This package implements the following commands:

ee cron

Manages cron on easyengine sites and host machine.

ee cron

ee cron create

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

ee cron create [<site-name>] --command=<command> --schedule=<schedule> [--user=<user>]

OPTIONS

[<site-name>]
	Name of site to run cron on.

--command=<command>
	Command to schedule.

--schedule=<schedule>
	Time to schedule. Format is same as Linux cron.

[--user=<user>]
	User to execute command as.

We also 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

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

So 1h10m2s is also a valid duration

EXAMPLES

# Adds a cron job on example.com every 10 minutes
$ ee cron create example.com --command='wp cron event run --due-now' --schedule='@every 10m'

# Adds a cron job on example.com every 1 minutes
$ ee cron create example.com --command='wp cron event run --due-now' --schedule='* * * * *'

# Adds a cron job on example.com every 1 minutes run as user www-data
$ ee cron create example.com --command='wp cron event run --due-now' --schedule='* * * * *' --user=www-data

# Adds a cron job to host running EasyEngine
$ ee cron create host --command='wp cron event run --due-now' --schedule='@every 10m'

# Adds a cron job to host running EasyEngine
$ ee cron create host --command='wp media regenerate --yes' --schedule='@weekly'

ee cron delete

Deletes a cron job

ee cron delete <cron-id>

OPTIONS

<cron-id>
	ID of cron to be deleted.

EXAMPLES

# Deletes a cron jobs
$ ee cron delete 1

ee cron update

Updates a cron job.

ee cron update <id> [--site=<site>] [--command=<command>] [--schedule=<schedule>] [--user=<user>]

OPTIONS

<id>
	ID of cron to update.

[--site=<site>]
	Command to schedule.

[--command=<command>]
	Command to schedule.

[--schedule=<schedule>]
	Time to schedule. Format is same as Linux cron.

[--user=<user>]
	User to execute command as.

We also 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

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

So 1h10m2s is also a valid duration

EXAMPLES

# 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 command and user of cron
$ ee cron update 1 --command='wp cron event run --due-now' --user=root

# Updates schedule of cron
$ ee cron update 1 --schedule='@every 1m'

ee cron list

Lists scheduled cron jobs.

ee cron list [<site-name>] [--all]

OPTIONS

[<site-name>]
	Name of site whose cron will be displayed.

[--all]
	View all cron jobs.

EXAMPLES

# Lists all scheduled cron jobs
$ ee cron list

# Lists all scheduled cron jobs of a site
$ ee cron list example.com

ee cron run-now

Runs a cron job

ee cron run-now <cron-id>

OPTIONS

<cron-id>
	ID of cron to run.

EXAMPLES

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

Contributing

We appreciate you taking the initiative to contribute to this project.

Contributing isn’t limited to just code. We encourage you to contribute in the way that best fits your abilities, by writing tutorials, giving a demo at your local meetup, helping other users with their support questions, or revising our documentation.

Reporting a bug

Think you’ve found a bug? We’d love for you to help us get it fixed.

Before you create a new issue, you should search existing issues to see if there’s an existing resolution to it, or if it’s already been fixed in a newer version.

Once you’ve done a bit of searching and discovered there isn’t an open or fixed issue for your bug, please create a new issue. Include as much detail as you can, and clear steps to reproduce if possible.

Creating a pull request

Want to contribute a new feature? Please first open a new issue to discuss whether the feature is a good fit for the project.

Support

Github issues aren't for general support questions, but there are other venues you can try: https://easyengine.io/support/

This README.md is generated dynamically from the project's codebase using ee scaffold package-readme (doc). To suggest changes, please submit a pull request against the corresponding part of the codebase.