canasta schedule add
canasta schedule add
Add a recurring maintenance command
Synopsis
Add a schedule that runs a shell command inside a container of the instance (the web container unless --service names another) on a standard 5-field cron expression minute hour day-of-month month day-of-week.
The command runs under bash (or sh where the container has no bash) inside the container, so paths, PHP, and the environment are the container's: php maintenance/run.php ... runs from the MediaWiki directory. In the web container it runs as www-data, as maintenance scripts do; in another service's container, as that image's user. A % in the command is passed through as is. On a wiki farm, pass --wiki=<id> in the command to target a wiki other than the first.
A name that is already in use is refused; to change a schedule, remove it and add it again. backup is reserved for canasta backup schedule.
On a gitops instance, --gitops-hosts limits the schedule to the named gitops hosts. It is then installed only on those hosts, so another host in the repository, or a clone restored from a backup, does not run it. Without it, every host runs the schedule against its own instance.
If a run is still going when the schedule fires again, the new run is skipped. A restart or upgrade that replaces the container stops a run in progress; it is recorded as failed and the next firing runs as usual.
canasta schedule add [flags]
Examples
canasta schedule add -n parser-cache --cron '0 3 * * *' --command 'php maintenance/run.php purgeParserCache --age 604800'
canasta schedule add -n rebuild --cron '30 4 * * 0' --command 'php maintenance/run.php rebuildall' --gitops-hosts prod
Flags
| Flag | Shorthand | Description | Default | Required | Orchestrator |
|---|---|---|---|---|---|
--command |
Shell command to run inside the container | ✓ | Both | ||
--cron |
5-field cron expression | ✓ | Both | ||
--name |
-n |
Schedule name (lowercase letters, digits, hyphens) | ✓ | Both | |
--gitops-hosts |
Comma-separated gitops hosts to run the schedule on (default: all) | Both | |||
--id |
-i |
Canasta instance ID | * | Both | |
--service |
-s |
Service whose container runs the command (default: web) | Both |
* Defaults to the Canasta instance matching the current directory, if any.
Global flags
| Flag | Shorthand | Description | Default | Required | Orchestrator |
|---|---|---|---|---|---|
--help |
-h |
Show help message and exit | Both | ||
--verbose |
-v |
Enable verbose output | Both |