User Tools

Site Tools



Command Line Arguments

From Official Manual

If all the above sounds complicated, you will probably agree that it really isn't after trying it a few times. It is possible to do everything that was shown above, with the exception of selecting the FileSet, by using command line arguments with a single command by entering:

restore client=Rufus select current all done yes

The client=Rufus specification will automatically select Rufus as the client, the current tells Bacula that you want to restore the system to the most current state possible, and the yes suppresses the final yes/mod/no prompt and simply runs the restore.

The full list of possible command line arguments are:

  • all – select all Files to be restored.
  • select – use the tree selection method.
  • done – do not prompt the user in tree mode.
  • current – automatically select the most current set of backups for the specified client.
  • client=xxxx – select the specified client.
  • jobid=nnn – specify a JobId or comma separated list of JobIds to be restored.
  • before=YYYY-MM-DD HH:MM:SS – specify a date and time to which the system should be restored. Only Jobs started before the specified date/time will be selected, and as is the case for current Bacula will automatically find the most recent prior Full save and all Differential and Incremental saves run before the date you specify. Note, this command is not too user friendly in that you must specify the date/time exactly as shown.
  • file=filename – specify a filename to be restored. You must specify the full path and filename. Prefixing the entry with a less-than sign (<) will cause Bacula to assume that the filename is on your system and contains a list of files to be restored. Bacula will thus read the list from that file. Multiple file=xxx specifications may be specified on the command line.
  • jobid=nnn – specify a JobId to be restored.
  • pool=pool-name – specify a Pool name to be used for selection of Volumes when specifying options 5 and 6 (restore current system, and restore current system before given date). This permits you to have several Pools, possibly one offsite, and to select the Pool to be used for restoring.
  • where=/tmp/bacula-restore – restore files in where directory.
  • yes – automatically run the restore without prompting for modifications (most useful in batch scripts).
  • strip_prefix=/prod – remove a part of the filename when restoring.
  • add_prefix=/test – add a prefix to all files when restoring (like where) (can't be used with where=).
  • add_suffix=.old – add a suffix to all your files.
  • regexwhere=!a.pdf!a.bkp.pdf! – do complex filename manipulation like with sed unix command. Will overwrite other filename manipulation.

Unofficial Added

bacula/src/dird/ua_restore.c suggest that the following arguments are recognized.

argument takes value what does it
jobid yes see above
current no see above
before yes see above
file yes see above
directory n.a. n.a.
select no see above
pool yes see above
all no see above
client yes ?match jobs with this client?
storage ?yes? ?match jobs with this storage?
fileset yes match jobs with this fileset
where yes see above
yes no see above
bootstrap ?yes? ?the bootstrap file to use?
done no see above
strip_prefix yes see above
add_prefix yes see above
add_suffix yes see above
regexwhere yes ?no clue?
restoreclient yes ?the client to restore to?

the questionmarks mean I guessed as I had not been able to determine it from the source.

bacula_manual/restore_command_command_line_arguments.txt · Last modified: 2007/09/27 23:12 (external edit)