Chapter 4. The Command-Line-Runner

If you have a configuration file named phpbu.xml in your current working directory you can execute phpbu like this

~$ phpbu
phpbu 4.0.0

Runtime:       PHP 7.1.0
Configuration: /home/user/phpbu.xml

OK (1 backup, 0 checks, 0 encryption, 0 syncs, 0 cleanups)

If you want to use a custom name for your configuration file you have to use the --configuration option.

~$ phpbu --configuration=MyConfig.xml
phpbu 4.0.0

Runtime:       PHP 7.0.2
Configuration: /home/user/MyConfig.xml

OK (1 backup, 0 checks, 0 encryption, 0 syncs, 0 cleanups)

Command-Line-Runner options

Here is the list of available options for the command line runner.

$ phpbu --help
phpbu 4.0.0

Usage: phpbu [option]

--bootstrap=<file>     A "bootstrap" PHP file that is included before the backup.
--configuration=<file> A phpbu xml config file.
--colors               Use colors in output.
--debug                Display debugging information during backup generation.
--limit=<subset>       Limit backup execution to a subset.
--simulate             Perform a trial run with no changes made.
-h, --help             Print this usage information.
-v, --verbose          Output more verbose information.
-V, --version          Output version information and exit.
--bootstrap

A "bootstrap" PHP file that is included before executing the backup.

--configuration

Path to the phpbu config file to use. See Chapter 2 for more details.

--colors

Use colors in output.

--debug

Display debugging information during backup generation.

--limit

Limit backup execution to a subset. See the limit section for details.

--simulate

Execute phpbu without actually executing any backup, check, encryption, sync or cleanup task. See the simulation section for details.

Simulation

In order to check what actions phpbu would perform, phpbu supports a simulation mode where no backup is actually created and no sync and cleanup tasks are executed. In simulation mode, phpbu will show you, what it would have done, if it would not have been a simulation run. You will get detailed output, which enables you to track every action phpbu would have performed.

This is a great way to test if the correct backup commands will be executed and if all the right backups will be cleaned up.

Warning

If phpbu has to use any kind of credentials executing a binaries, like for example the mysqldump command, this credentials will maybe displayed in the simulation output.

If you are extending phpbu, you can support simulation as well. You can find detailed information on this in Chapter 11.

Limit

If you don't want to execute all of your configured backups you can define a subset of backups by using the limit option.

All you have to to, is to set the limit option to a comma separated list of backup names (nameA,nameB,nameC).

Warning

If you don't define explicit backup names, phpbu will use the source type as backup name as fallback.

Please open a ticket on GitHub to suggest improvements to this page. Thanks!