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 name a plan with its identifier, for example plan-1, or with its name. For the letters a to z, upper and lower case do not matter in the name; umlauts you write 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 names two lines per plan. The first carries the identifier, the state, the name, the rhythm with the start time and the identifiers of the targets. The second names the next run, the last run, the content, Max. backups and the snapshot. The last line counts the plans and names how many there may be at most.
| 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 names a run that was missed after that. could not start means: the last scheduled run could not start. |
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 --targets=sftp-1 --rhythm=daily --time=03:15 --name="Nachts" # Sundays at 22:00 database and uploads, keep 3 backups wp cloneworx-backup plan add --targets=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 --targets is required. Everything else has a default.
| Parameter | Meaning | Allowed values |
|---|---|---|
--targets=<ID> |
The target of the plan, in the form Backups go to. Required. | The identifier of a usable target, not its name. The free version allows one target per plan. |
--name=<name> |
The name of the plan. Without the parameter the plugin assigns its suggestion. | At most 100 characters. Any name that no other plan carries yet works. |
--rhythm=<Rhythmus> |
Rhythm |
1h, 2h, 4h, 6h, 12h, daily, weekly, monthly. 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. |
--retention=<Zahl> |
Max. backups: this many good backups stay per target. | 1 to 99. Default: 7. |
--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. - The free version allows two plans. Once the limit is reached, the command does not create another one.
The areas for --roots
| Value | In the form | Content |
|---|---|---|
db |
Database | The tables of the database that belong to this website. |
wp-config |
wp-config.php | The file wp-config.php. A restore never restores it. |
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 root folder of the website, for example .htaccess and robots.txt. |
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 --targets=local-1
edit takes the same parameters as add and needs at least one of them. Only what you name is changed. If you change rhythm, day or time, the plugin recalculates the next run. The random addition to the time stays the same.
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 names 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 scheduler triggers the website. If no scheduler comes 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: only the schedule is paused. The backup counts towards the plan and counts as its last run. It does not shift the next scheduled 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 good 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 names 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 an entry does not fit, the command saves nothing. It names 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 names an area that does not exist. |
targets |
required |
The list is empty. |
targets |
too_many |
The plan names more targets than are allowed. |
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. |
A time in the wrong form is refused by the command at once, and it names the allowed form. If the maximum number of plans is reached, it reports the limit, for example At most 2 plans.