[Borgbackup] [IDEA] Add support for external commands

Melkor Lord melkor.lord at gmail.com
Sat Oct 1 14:25:46 EDT 2016


Hi,

Playing a bit with Borg made me think of something that could be very
useful. It's just a rough idea. It involves extending "stdin" via "borg
serve".

We can already to something like : someapp | borg create
/path/to/repo::name -

It would be really useful to extend that to "borg serve". Get the output of
any arbitrary command to backup (stdout) and display any errors (stderr) if
they should occur.

Typically, this would be useful for remote backups of application data such
as SQL dumps, LDAP dumps, whatever... Something like :

borg create --remote-cmd user at host: -- mysqldump [options] db.sql

or

borg create --remote-cmd user at host: -- somebigscriptdoingstuff

This would connect to "user at host" and "--remote-cmd" would instruct the
remote "borg serve" process to execute whatever is after "--" and retrieve
stdout, stderr and also the returncode of the executed app.

if "--remote-cmd" is used, no path allowed after the ":" in "user at host:"
part and "--" would be required. This would allow to use complex commands
without the need of tricky shell escapes.

What do you think?

A nice addition to that would be an option like "--skip-cmd-fail" that
would NOT create the backup (or create it and delete it afterwards if I
understand the way Borg currently works) if the returncode of the remote
command is non-zero. Even better, for strange and unusual commands,
"--skip-cmd-fail=1,2,3" that would list the returncodes triggering the
non-creation of the backup.

This kind of feature would be a huge life saver for admins.

PS: I know we currently can do something like :
ssh user at host "do-stuff" | borg create /path/to/repo::name
but this lacks the more thorough controls borg could achieve by wrapping
all the process.

-- 
Unix _IS_ user friendly, it's just selective about who its friends are.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/borgbackup/attachments/20161001/31d0b186/attachment.html>


More information about the Borgbackup mailing list