With the command plan you manage your backup plans on the command line: show, create, change, pause, switch on, run at once and delete.
WP-CLI is not set up yet? Then start with Install WP-CLI. What applies to every command, for example the user and the parameter --force, is described in The commands at a glance.
A backup plan bundles when a backup runs, what it contains, where it goes and how many backups stay per target. You specify a plan by its identifier, for example plan-1, or by its name. For the letters a to z, upper and lower case do not matter in the name; you write umlauts as they appear in the name. A name with spaces is put in quotation marks.
Every action except list checks whether you are working as the user who owns the folders of the plugin. --force skips this check.
Showing plans: list
# Show all backup plans with state, frequency and next run wp cloneworx-backup plan list
The output shows two lines per plan. The first contains the ID, the state, the name, the rhythm with the start time and the IDs of the targets. The second shows the next run, the last run, the content, Max. backups and the snapshot. The last line counts the plans and the active plans. If a plan that is switched on does not run on schedule, the reason is on a line of its own below the plan.
| In the output | Meaning |
|---|---|
active |
The plan is active and runs at its next run on its own. |
paused |
The plan is paused. No backups are scheduled. |
paused (no target) |
The plan is paused because it has no target any more. Choose a target, then it can be switched on. |
next run |
The next run in the time zone of the website. For a paused plan a dash is shown here. |
last run |
The last run with its trigger: schedule (schedule), manual (on the pages of the plugin) or cli (command line). missed shows a run that was missed after that. could not start means: the last scheduled run could not start. After the code in brackets comes the reason in plain text. |
roots |
What the plan backs up, as a list of the areas. |
retention |
Max. backups |
snapshot |
Back up the database as a snapshot: yes or no
|
Creating a plan: add
# Back up daily at 03:15 to the target sftp-1 wp cloneworx-backup plan add --target=sftp-1 --rhythm=daily --time=03:15 --name="Nachts" # Sundays at 22:00 database and uploads, keep 3 backups wp cloneworx-backup plan add --target=local-1 --rhythm=weekly --weekday=7 --time=22:00 --roots=db,wp-uploads --retention=3 # Enable the new backup plan wp cloneworx-backup plan resume "Nachts"
Only --target is required. Everything else has a default.
| Parameter | Meaning | Allowed values |
|---|---|---|
--target=<ID> |
The target of the plan, in the form Targets and rotation. Required. | The ID of a usable target, not its name. Exactly one target: the command does not split the value at a comma. wp pro-plan takes several targets with --targets. |
--name=<name> |
The name of the plan. Without the parameter the plugin assigns its suggestion. | At most 100 characters. Any name works that no other plan has yet. |
--rhythm=<Rhythmus> |
Rhythm |
1h, 2h, 4h, 6h, 12h, daily, weekly, monthly. wp pro-plan also accepts 5m, 10m, 15m, 30m. Default: daily. |
--time=HH:MM |
Time in the time zone of the website. | Hour 0 to 23, minutes 00, 15, 30 or 45. Default: a random time. |
--weekday=<Zahl> |
Weekday, for the rhythm weekly. |
1 for Monday to 7 for Sunday. Default: 1. |
--monthday=<Tag> |
Day of the month, for the rhythm monthly. |
1 to 28, or last for the last day of the month. Default: 1. |
--roots=<Liste> |
What is backed up: the areas, separated by commas. | See the table of the areas. Default: all. The command does not accept wp-config: the file wp-config.php is never part of a backup. |
--retention=<Zahl> |
Max. backups: this many valid backups stay per target. | 1 to 99. Default: 7. 0 only with the retention by age of cloneworx Backup Pro. |
--snapshot=<Wert> |
Back up the database as a snapshot |
yes or no. Default: yes. |
--force |
Skips the check of the user. |
-
A new plan is paused. It only runs once you switch it on with
resume. - The start time can differ from the time. When creating, the plugin randomly adds 0 to 14 minutes and keeps this addition. 03:15 becomes 03:22, for example. This way not all websites of a server start in the same minute.
-
For the rhythms from
1hto12honly the minute of the time counts. The runs are spaced from midnight at the interval of the rhythm. -
With
5mto30m, the rhythms ofwp pro-plan, no time counts, and there is no random offset. The command warns with the wording of the dialog Attention that these rhythms need a system cron, and creates the plan all the same: Backups every 5 to 30 minutes. -
In the free version one plan runs on schedule. If a plan is already switched on,
resumerefuses a second one and names the plan you have to pause first. With cloneworx Backup Pro every plan that is switched on runs on schedule.
The areas for --roots
| Value | In the form | Content |
|---|---|---|
db |
Database | The tables of the database that belong to this website. |
wp-content |
wp-content | Everything in wp-content that does not belong to plugins, themes, must-use plugins or uploads. |
wp-core |
WordPress core | The folders wp-admin and wp-includes and the files that WordPress ships in the root folder. |
wp-mu-plugins |
Must-use plugins | The folder of the must-use plugins. |
wp-plugins |
Plugins | The folder of the plugins. |
wp-themes |
Themes | The folder of the themes. |
wp-uploads |
Uploads | The folder of the uploads. |
wp-root |
Root folder | Everything else in the folder of the WordPress core, for example .htaccess and robots.txt. If WordPress lives in its own subfolder with its own address, the files of the web root belong to it as well. |
Exclusion rules and tables of which only the structure is backed up apply to the whole website and thus to every plan. More about this: Define what gets backed up.
Changing a plan: edit
# Change the time and disable the snapshot wp cloneworx-backup plan edit "Nachts" --time=04:30 --snapshot=no # Choose a different target wp cloneworx-backup plan edit plan-1 --target=local-1
edit accepts the same parameters as add and needs at least one of them. Only what you specify is changed. If you change rhythm, day or time, the plugin recalculates the next run. The random addition to the time stays the same. If the plan carries settings of cloneworx Backup Pro and cloneworx Backup Pro is active with a valid licence, plan edit changes nothing and names wp pro-plan edit. If cloneworx Backup Pro is missing or its licence is not valid, plan edit removes these settings from the plan and says so in a warning.
Pausing and switching on: pause and resume
# Pause the backup plan wp cloneworx-backup plan pause plan-1 # Enable the backup plan wp cloneworx-backup plan resume plan-1
resume shows the next run in the output. The plugin calculates it from now: a plan that was paused for weeks does not start the moment you switch it on. A plan can only be switched on with a usable target, that is, a target whose last connection test succeeded.
An active plan starts at its next run on its own as soon as a task source triggers the website. If no task source runs within one hour after the scheduled time, the run counts as missed: nothing starts, and the plan moves on to its next regular run. A website without visitors therefore needs a system cron: Schedule and system cron with WP-CLI.
Running a plan at once: run
# Run the backup plan now and wait for the result wp cloneworx-backup plan run "Daily backup" # Only start the backup; the website continues it wp cloneworx-backup plan run plan-1 --background
run starts a backup at once with the content and the target of the plan. That also works for a paused plan: the pause only affects the schedule. The backup counts towards the plan and counts as its last run. It does not shift the next scheduled run. If the plan carries settings of cloneworx Backup Pro, plan run starts nothing and names wp pro-plan run.
| Parameter | Meaning |
|---|---|
--background |
The command starts the backup and ends. The website continues it itself; wp cloneworx-backup job status shows the state. |
--force |
Skips the check of the user. |
Without --background the command shows one line with the progress per step: the phase, the number of entries, the amount and, as soon as it can be estimated, the remaining time. At the end the result is shown with the number of steps and warnings, below it the details on database, files and transfer per target. After a valid backup the command also runs the follow-up to its end: it deletes backups that exceed Max. backups and cleans up leftovers at the targets.
If the backup fails, the output shows the last messages of the job, the state per target and the reason. If the plan has no usable target or another job is already running, the command starts nothing and says so.
Deleting a plan: remove
# Delete the backup plan; its backups are kept wp cloneworx-backup plan remove "Nachts"
The command does not ask
Unlike on the Backup page, there is no confirmation prompt here: the plan is deleted at once. The backups it made stay.
If you delete all plans, the plugin creates a first plan again with the next target you add.
When the command refuses an entry
If a value is not valid, the command saves nothing. It shows the field with a code and ends with Plan settings are not valid.
| Field | Code | Meaning |
|---|---|---|
name |
required, taken, too_long
|
The name is empty, already belongs to another plan or is longer than 100 characters. |
rhythm, weekday, monthday, snapshot
|
invalid |
The value is not in the table of allowed values. |
roots |
required, invalid
|
The list is empty or contains an area that does not exist. |
targets |
required |
The list is empty. |
targets |
unknown |
The target does not exist, or it is removed. |
targets |
not_usable |
The target is not usable. Test its connection first. |
retention |
invalid, out_of_range
|
The value is not a whole number or does not lie between 1 and 99. |
state |
no_usable_target |
The plan cannot be switched on because it has no usable target. |
state |
single_plan |
In the free version another plan is already switched on. The command warns: Only one plan runs on schedule. Pause the plan "…" first.
|
rhythm |
pro_rhythm |
This rhythm exists only with cloneworx Backup Pro. Choose another rhythm (--rhythm) to switch the plan on. |
retention |
retention_required |
Max. backups is 0. Set --retention to a number from 1 to 99. |
retention |
retention_pro_missing |
The plan has tiers of the retention by age but no valid licence. Set --retention to a number from 1 to 99 and then switch the plan on again. |
The command refuses a time in the wrong form at once and shows the allowed form.
PROSeveral targets and short rhythms: wp pro-plan
This feature belongs to cloneworx Backup Pro: Installation · Order
# Two targets, s3-1 gets only the first run of each week wp pro-plan add --targets=local-1,s3-1 --rules=s3-1:weekly --rhythm=daily --time=03:15 --name="Nachts" # Set the rhythm to every 15 minutes wp pro-plan edit "Nachts" --rhythm=15m # Run the plan now, at the targets of this run wp pro-plan run "Nachts" # A backup without a plan to two targets wp pro-backup run --targets=local-1,s3-1
wp pro-plan add and wp pro-plan edit accept every parameter of plan add and plan edit. In addition there are --targets with one target or several, separated by commas, --rules with the rule for each further target in the form <Ziel>:<Regel>, and the rhythms 5m, 10m, 15m and 30m. wp pro-plan run starts a plan right away, with --background as in plan run. wp pro-backup run starts a backup without a plan at the targets from --targets. All four need a valid licence. More about this: The 3-2-1 rule - the gold standard for backups and Backups every 5 to 30 minutes.
PROExceptions per plan: wp pro-plan
This feature belongs to cloneworx Backup Pro: Installation · Order
The command wp pro-plan manages the exceptions of a plan: rules that apply only to this plan, in addition to the exclusions of the website. add and edit need a valid licence: The licence of cloneworx Backup Pro.
# Show the exceptions of all plans wp pro-plan list # Create a daily plan without JPG files of the uploads wp pro-plan add --targets=local-1 --rhythm=daily --time=03:15 --name="Ohne Bilder" --exclusions="wp-uploads/**/*.jpg" # Replace the exceptions of a plan wp pro-plan edit "Ohne Bilder" --exclusions="wp-uploads/**/*.jpg,wp-uploads/**/*.png" # Remove the exceptions of a plan wp pro-plan edit "Ohne Bilder" --exclusions=""
For each plan, list shows the ID, the name, the exceptions and the tiers of the retention by age. add and edit accept all parameters of plan add and plan edit and in addition --exclusions: the rules, separated by commas, in the same forms as the exclusions. --exclusions replaces the exceptions of the plan; an empty value removes them. In the form of the plan: Backup plans: tile and form.
PRORetention by age: wp pro-plan --age
This feature belongs to cloneworx Backup Pro: Installation · Order
# Set the retention by age wp pro-plan edit "Nachts" --age=run:2,daily:7,weekly:4,monthly:12 # Back to a fixed number wp pro-plan edit "Nachts" --age="" --retention=7
--age accepts the four tiers: run in hours, daily in days, weekly in weeks, monthly in months. Tiers not specified are 0; an empty value switches all off. With a tier, --retention is 0. What the tiers do: Retention by age.
PROEncrypt backups: wp pro-plan --encrypt
This feature belongs to cloneworx Backup Pro: Installation · Order
# Switch on the encryption of a plan wp pro-plan edit "Nachts" --encrypt=yes # Switch off the encryption of a plan wp pro-plan edit "Nachts" --encrypt=no
--encrypt=yes needs a valid licence. The plan encrypts only once the recovery key is set up. wp pro-plan list names for every plan whether the plan encrypts. More about this: Encrypt backups.