BackupPC-users

Re: [BackupPC-users] Not backing up more that first module/directory (rsyncd)

2009-04-12 23:20:02
Subject: Re: [BackupPC-users] Not backing up more that first module/directory (rsyncd)
From: Adam Goryachev <mailinglists AT websitemanagers.com DOT au>
To: "General list for user discussion, questions and support" <backuppc-users AT lists.sourceforge DOT net>
Date: Mon, 13 Apr 2009 13:15:40 +1000
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Holger Parplies wrote:
> Hi,
> 
> Boniforti Flavio wrote on 2009-04-12 10:20:12 +0200 [[BackupPC-users] Not 
> backing up more that first module/directory (rsyncd)]:
>> I¹ve succesfully set up BackupPC to get data from remote Windows hosts with
>> ssh tunnel and rsyncd.
>>
>> What I¹m now experiencing is that after having correctly completed first
>> module/directory, it doesn¹t connect anymore to the subsequent one.
>> Here log excerpt:
>>
>> [...]
>> incr backup started back to 2009-04-10 17:33:03 (backup #2) for directory
>> ExchBkp
>> Error connecting to rsync daemon at localhost:8874: inet connect:
>> Connessione rifiutata
>> Got fatal error during xfer (inet connect: Connessione rifiutata)
>> Backup aborted (inet connect: Connessione rifiutata)
>>
>> I thought it was the ssh tunnel being closed, therefore I changed the ³sleep
>> 20² command to ³sleep 60², but didn¹t change anything.
> 
> I agree that it is the ssh tunnel closing when the last (= only) tunnelled
> connection closes. Changing the sleep parameter to 60 should only make a
> difference if the first module takes less than 60 seconds to back up.
> Remember that it's not the time between the two shares you're gapping, it's
> the time between DumpPreUserCmd and the first connection. After running the
> command (sleep 20), ssh waits for any tunnelled connections to close and then
> terminates.
> 
>> What do you people suggest?
> 
> I haven't got a working implementation, but I'd suggest running a command that
> does *not* complete (ever, basically) over ssh in the DumpPreUserCmd and
> killing that command (or the ssh) in the DumpPostUserCmd. That would also get
> rid of the race condition you currently have: if the backup, for some reason,
> takes more than 20 seconds to start (from the time the DumpPreUserCmd is run),
> it will fail. That is probably highly unlikely, but it *is* possible.
> 
> Alternatively, set up the tunnel in DumpPreShareCmd instead of DumpPreUserCmd.
> Then you will be using a new tunnel for each share.

I have (successfully) been using a script to do this for the past few
months. I copied this from somewhere else (the wiki perhaps) and have
tuned locally since then...

I created a script in /etc/backuppc/scripts/hostname.sh
#!/bin/bash
TERM=vt100
/usr/bin/screen -d -m -S hosttunnel /usr/bin/ssh -o
ServerAliveInterval=15 -o ServerAliveCountMax=10 -q -x -C -L
1516:127.0.0.1:873 -l root host
/bin/sleep 20

# NOTE: sleep 20? we needed to introduce a small delay to ensure the
tunnel was fully established before rsync started
# NOTE: "-S hosttunnel" helps us identify the process - so we can kill
it when the backups are finished
# NOTE: This could be done with dtach instead of screen
# NOTE: the string host should be replaced with the hostname

$Conf{ClientNameAlias} = '127.0.0.1';
$Conf{DumpPreUserCmd}='/etc/backuppc/scripts/host.sh';
$Conf{DumpPostUserCmd}='/usr/bin/pkill -u backuppc -f host';
$Conf{RestorePreUserCmd}='/etc/backuppc/scripts/host.sh';
$Conf{RestorePostUserCmd}='/usr/bin/pkill -u backuppc -f host';
$Conf{RsyncdClientPort}='1516';
# This 1516 matches the 1516 in the above script, each tunneled host
should use a unique port number so that parallel backups don't interfere
with each other


Hope that helps, if anyone sees something wrong with the above config,
please let me know.

Regards,
Adam
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAknirlEACgkQGyoxogrTyiVFigCdE7dh8zfqZRXB/CVQnkxkRau/
HTIAoJaOKk7Cl/PHLVv21ZrlivCeTcUT
=Ar8Z
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
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/