BackupPC-users

Re: [BackupPC-users] Here my log

2009-04-08 20:57:53
Subject: Re: [BackupPC-users] Here my log
From: Holger Parplies <wbppc AT parplies DOT de>
To: Johan Ehnberg <johan AT ehnberg DOT net>
Date: Thu, 9 Apr 2009 02:46:11 +0200
Hi,

Johan Ehnberg wrote on 2009-04-08 15:49:30 +0300 [Re: [BackupPC-users] Here my 
log]:
> [...]
> SSH is backgrounded with the -f switch.

ah, didn't know that one, but it's just what is needed here, obviously.

> [...]
> >- The script which starts ssh (or, equivalently, the
> >"ssh && echo" sequence)? How do you tell BackupPC whether the "ssh"
> >was successful (return code of the DumpPreUserCmd, determining
> >whether to proceed with the backup or not)?
> 
> By using "&&". It's a shell syntax meaning about 'and if successful', in 
> other words I believe it checks the exit status of the previous command. 

Correct. "Successful" is return code 0, contrary to boolean expectations.
But it doesn't tell BackupPC whether ssh was successful, it only ...

> makes the BackupPC log show "SSH started successfully."

But there's more shell syntax allowing passing a return code:

        ssh ... && echo "SSH started successfully" || exit 1
        exit 0

Then set

        $Conf {UserCmdCheckStatus} = 1;

to make BackupPC abort the backup if the tunnel is not established
successfully.

> Now that you brought this up, I actually realized that integrating the 
> whole tunnel functionality in BackupPC would be pretty easy in theory. A 
> single conf line or split up into simple parts (GATE, CLIENT, and a 
> "enable tunnel"-switch) would perhaps suffice as the ports could be 
> handled dynamically.

I'm not exactly sure what you are suggesting, but there are many ways you
might want to set up a tunnel, so you'd need to be able to run an arbitrary
command before and another one after the backup. I think we've got that
already. It's called DumpPreUserCmd/DumpPostUserCmd (and for Restore and
Archive respectively). Even for simple ssh tunnels I'd want to be able to add
options like '-i', '-C', '-c', '-p' ... I don't see adding complexity making
anything any easier.

Regards,
Holger

------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
BackupPC-users mailing list
BackupPC-users AT lists.sourceforge DOT net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/