Command Line Usage

Navigation:  Backup Providers Integration >

Command Line Usage

Previous pageReturn to chapter overviewNext page

A command line interface to restore_infected library is present in the file restore_infected_cli.py. If installed from the RPM, the binary is located in /usr/bin/restore_infected and can be used as “restore_infected”. To use the CLI a backend and an action should be specified.

 

The library includes the following backup backend plugins:

 

Acronis;

cPanel;

Plesk.

 

Synopsis

 

restore_infected BACKEND ACTION

 

Where BACKEND is one of the backends - predefined or custom and ACTION is one of the actions described below.

 

Actions

 

init

 

The first step most of the plugins will need is initialization. The most common use of it is to save credentials for the backup server.

 

init arg0 arg1 ...

 

The arguments may vary depending on the backend used. To see which arguments are needed for the particular plugin you can call init with no arguments:

 

restore_infected acronis init
usage: restore_infected [-h] BACKEND {init,list,restore,cleanup} ...
restore_infected: error: init arguments required: username password

 

To install Acronis backup agent, pass --provision option to init command. To force installation when agent is present use --force option.

 

list

 

list shows available backups sorted by date starting with the newest.

 

list [--until]

 

If a date string is passed as --until, list all backups from now up to that date or all backups otherwise. The date for --unitil parameter can be in any format that python-dateutil can parse, e.g. "2017-08-01", "01 Aug 2017", etc.

 

Example:

 

restore_infected acronis list --until "01 Aug 2017"
2017-08-06T10:22:00
2017-08-05T06:00:00
2017-08-03T12:32:00

 

restore

 

restore files [--until]

 

Restore files from backup. restore takes a list of files (paths to them) which are considered infected, searches for the first uninfected entry of each file in backups and restores it. Backups older than the date set in --until are not considered.

 

Example:

 

restore_infected acronis restore "/root/file1" "/root/file2" --until "01 Aug 2017"

 

cleanup

 

The most common use is to delete any temporary files created by the plugin. Depending on the backend the functionality may vary or such function might not be present at all.

 

Example:

 

restore_infected plesk cleanup

 

extra

 

This is for acrivity not connected to restoring from backups.

 

Currently supported options are

login_url (for Acronis backend). This option returns url to log in to Acronis cloud web-interface;

refresh_token (for Acronis backend). This option refreshes authentication token to keep it valid.