Gentoo Archives: gentoo-user

From: Roger Mason <rmason@×××××××.ca>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] rsync via ssh
Date: Sun, 04 Nov 2007 18:59:15
Message-Id: y65k5oxn8ue.fsf@minnie.esd.mun.ca
In Reply to: Re: [gentoo-user] rsync via ssh by Ralph Slooten
1 Hi Ralph,
2
3 Ralph Slooten <axllent@×××××.com> writes:
4
5 > I have done a similar thing at work, except what I do is first create
6 > an ssh tunnel, then rsync to the locally listening port. Works
7 > perfectly. In my setup the remote server is running an SSH server
8 > which is not accessible directly. Maybe this will help you.
9 >
10 >
11 > #!/bin/bash
12 > SSL_COMMAND="ssh -p 2222 sshuser@myserver -f -N -L 8000:localhost:873"
13 > SSL_PID=`ps aux | grep "$SSL_COMMAND" | egrep -v 'grep' | awk '{print $2}'`
14 >
15 > if [ "$SSL_PID" == "" ]; then
16 > echo "=> Creating SSH tunnel to myserver"
17 > $SSL_COMMAND
18 > SSL_PID=`ps aux | grep "$SSL_COMMAND" | egrep -v 'grep' | awk
19 > {print $2}'`
20 > else
21 > echo "=> SSH tunnel already exists. Using existing tunnel."
22 > fi
23 >
24 > if [ "$SSL_PID" != "" ]; then
25 > echo "=> Connecting through SSH tunnel with PID $SSL_PID"
26 > rsync rsync://localhost:8000/wwwroot
27 > /mnt/samba/hotcopy/myserver/wwwroot \
28 > -rvtzp --delete --modify-window=1
29 >
30 > echo "=> Closing SSH tunnel"
31 > kill $SSL_PID
32 > else
33 > echo "ERROR: SSH Connection failed! The backup could not complete"
34 > fi
35
36 Another responder suggested rdiff-backup. I'll give that a try first.
37
38 Thanks,
39 Roger
40 --
41 gentoo-user@g.o mailing list