[Borgbackup] [IDEA] Add support for external commands

Marian Beermann public at enkore.de
Sun Oct 2 04:07:08 EDT 2016


On 02.10.2016 10:03, Marian Beermann wrote:
> On 02.10.2016 01:38, Melkor Lord wrote:
>> On Sat, Oct 1, 2016 at 8:45 PM, Walker Traylor
>> <wtraylor at areyouthinking.org <mailto:wtraylor at areyouthinking.org>> wrote:
>>
>>     "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."
>>
>>     What more thorough controls do you require?
>>
>>
>> Quite simple : if "do-stuff" fails for some reason, there's a lot of
>> work to determine how to suppress the "failed" backup that Borg's going
>> to make anyway.
>>
>> ssh user at host "echo '' ; /bin/false" | borg create /path/to/repo::test -
>>
>> see? Now there's a "test" backup which is empty and serves no purpose at
>> all. Because of the pipe, I don't know that the ssh command failed. Borg
>> didn't fail but I have no way to distinguish "test" between "legit but
>> no new data" from "failed empty useless data" type of backup.
>>
> 
> That's a good point.
> 
> I could imagine something like
> 
> borg create /path/to/repo::test --from-command "ssh user at host ..."
> 
> Which would execute that command (in a local shell) and put stdout into
> an archive, while leaving stderr connected to stderr. If the
> command/shell exits with a nonzero status, a rollback is made and no
> backup would be created.
> 
> Cheers, Marian
> 

What I don't quite understand yet is where borg serve comes into play.
If I do, e.g. "ssh someone at somewhere false" then the error code is
propagated to the host and ssh itself exits with it. So no specific
handling for SSH would be needed, unless I'm overlooking something here.

Cheers, Marian


More information about the Borgbackup mailing list