You can also control targets, backup plans, backups, restore and settings of cloneworx Backup on the command line, without a browser. Here you find all commands of the plugin with their actions and the rules that apply to every command.
WP-CLI is not set up on your server yet? Then start with Install WP-CLI.
How a command is structured
Every command begins with “wp cloneworx-backup”. After that follow the command, the action, a name if needed and the parameters. A parameter begins with two hyphens.
# Command target, action test, target local-1 wp cloneworx-backup target test local-1 # Command plan, action run, backup plan plan-1, parameter --background wp cloneworx-backup plan run plan-1 --background
- You run the commands in the folder of your website, that is, where WordPress is located.
- If you leave out the action, the default of the command applies.
wp cloneworx-backup targetis the same aswp cloneworx-backup target list. - The outputs are in English and are not translated.
- The help of WP-CLI names the actions and parameters for every command, for example
wp help cloneworx-backup target.
All commands
The action in bold is the default and applies when you name no action.
| Command | Actions | What for | More about this |
|---|---|---|---|
target |
list, add, edit, remove, test, check, cleanup, moved, copy, sites, adopt, rebuild | Show, create, change, remove and test targets. Check the backups at a target, clean up leftovers, answer a fingerprint conflict, find backups after a total loss. | Manage targets with WP-CLI |
plan |
list, add, edit, pause, resume, remove, run | Show, create, change, pause, switch on, delete and run backup plans at once. | Manage backup plans with WP-CLI |
backup |
run, list, lock, unlock, check, download, delete | Create a backup without a plan. Show, lock, check backups, write them as a file and delete them. | Create and manage backups with WP-CLI |
retention |
list, run | Show which old backups would be dropped according to Max. backups, or delete them now. | Create and manage backups with WP-CLI |
restore |
precheck, run, status, keep, undo | Run the pre-check, start a restore, show its state, keep it or undo it. | Restore and import with WP-CLI |
import |
none; the command takes the path of a file and the parameter --target
|
Store a backup file at a target of this website and add it to the list of backups. | Restore and import with WP-CLI |
scheduler |
status, tick | Show the schedule. With tick, check whether a plan is due and start it: that is the line for the system cron. | Schedule and system cron with WP-CLI |
settings |
list, get, set, reset | Show, read, set the settings of the website and reset them to the defaults. | Settings and scope with WP-CLI |
scope |
roots, tables, exclusions, all | Show what belongs to the website. Set the exclusion rules and the tables of which only the structure is backed up. | Settings and scope with WP-CLI |
status |
none | Show the state of the website: the same result as the status tile of the Overview page. | State, logs and support with WP-CLI |
logs |
none | List the log files or write all of them into a tar file. | State, logs and support with WP-CLI |
support |
none | Print the support report or write it to a file. | State, logs and support with WP-CLI |
debug |
on, off, status | Switch debugging in the log on and off. After 24 hours it switches itself off. | State, logs and support with WP-CLI |
notify |
status, check, test | Show the state of the notifications, check for overdue backups now, send a test email. | State, logs and support with WP-CLI |
news |
status, subscribe, unsubscribe | Show, start or end the subscription to news on cloneworx Backup. | State, logs and support with WP-CLI |
job |
run, status, abort, probe, filelist, dbexport, files | Run the current job to its end, show its state or abort it. Start the probe run and the diagnostic jobs. | State, logs and support with WP-CLI |
Naming target, plan and backup
| What | How you name it | Where you find it |
|---|---|---|
| Target | After the action with its identifier (local-1, sftp-1) or its name. In the parameters --targets and --target the identifier is used. |
wp cloneworx-backup target list |
| Plan | After the action with its identifier (plan-1) or its name. In the parameter --plan the identifier is used. |
wp cloneworx-backup plan list |
| Backup | With its job name: date, time and an identifier of 32 characters. | wp cloneworx-backup backup list |
In the name of a target, upper and lower case do not matter. In the name of a plan this applies to the letters a to z; umlauts you write as they appear in the name. A name with spaces you put in quotation marks: wp cloneworx-backup plan run "Daily backup".
As which user you work
WP-CLI often runs as a different user than the website. The website could not change or delete files and folders that a command then creates later on. That is why almost every command that changes something or starts a job first checks whether you are working as the user who owns the folders of the plugin. If not, it aborts and names both users. In the example below web and vuser are the user and the group of the website; put in those of your website.
# Run as the website's user (example: web and vuser) sudo -u web -g vuser -H wp cloneworx-backup backup run
- The actions
listandstatusdo not check the user: you can show lists and states under any user.settingsdoes not check it when setting either, because the command only writes to the database. -
backup lock,backup unlock,backup download,job run,job abort,logsandsupportalso run without the check. - With
--forcea command runs anyway and only warns. The risk remains: what it creates belongs to the wrong user. -
restore run,restore keepandrestore undohave no--force. A restore writes into the website itself.
In this process or in the background
Backup, check, cleanup, restore and import run as a job in many short steps. Without a further parameter the command runs the job itself to its end. It shows one line with the progress per step and the result at the end. It leaves out the pause between the steps from the settings.
The restore is an exception: the command hands the switch-over to the restored state to the web server and waits until it is done. More about this: Restore and import with WP-CLI.
With --background the command only starts the job. The website then continues it itself: through the self-request of the server, with WP-Cron as the safety net below. wp cloneworx-backup job status shows the state.
| Command | Actions with --background
|
|---|---|
target |
check, cleanup, adopt, rebuild |
plan |
run |
backup |
run, check |
restore |
run, keep, undo |
import |
the command itself |
scheduler |
tick |
job |
probe, filelist, dbexport, files |
One job per website
Only one job ever runs at the same time. If one is already running, the command refuses the start and names the running job: Another job is active: …. One job per site.
Passwords and keys
The command line never accepts passwords and keys. Every value would appear there in the list of processes and in the history of the shell. That is why you set up targets with credentials on the Targets page. Afterwards you can test and check them and use them in a plan on the command line too.
The parameter --path
--path is a parameter of WP-CLI, not of the plugin: it names the path to WordPress when you are not in the folder of the website. The folder of a local target you set with --set-path.
# The path to WordPress: a WP-CLI switch wp cloneworx-backup status --path=/pfad/zur/website # The folder of a local target: a setting of the target wp cloneworx-backup target add local --set-path=/var/backups
The same path as the web server
Call WP-CLI via the path through which the web server also reaches the website. The fingerprint of the installation contains the path on the server. Via another path, for example a symlink, the same installation looks like a copy: the plugin records a fingerprint conflict and writes and deletes nothing at this target.