I have done a similar thing at work, except what I do is first create an ssh tunnel, then rsync to the locally listening port. Works perfectly. In my setup the remote server is running an SSH server which is not accessible directly. Maybe this will help you.

#!/bin/bash
SSL_COMMAND="ssh -p 2222 [EMAIL PROTECTED] -f -N -L 8000:localhost:873"
SSL_PID=`ps aux | grep "$SSL_COMMAND" | egrep -v 'grep' | awk '{print $2}'`

if [ "$SSL_PID" == "" ]; then
        echo "=> Creating SSH tunnel to myserver"
        $SSL_COMMAND
SSL_PID=`ps aux | grep "$SSL_COMMAND" | egrep -v 'grep' | awk '{print $2}'`
else
        echo "=> SSH tunnel already exists. Using existing tunnel."
fi

if [ "$SSL_PID" != "" ]; then
        echo "=> Connecting through SSH tunnel with PID $SSL_PID"
rsync rsync://localhost:8000/wwwroot /mnt/samba/hotcopy/myserver/wwwroot \
        -rvtzp --delete --modify-window=1

        echo "=> Closing SSH tunnel"
        kill $SSL_PID
else
        echo "ERROR: SSH Connection failed! The backup could not complete"
fi



Cheers,
Ralph

Roger Mason wrote:
Hi Richard,

Richard Ruth <[EMAIL PROTECTED]> writes:

Try adding "-e ssh" to your rsync command.
Search for "-e" in the rsync man page for an example.
=======================
This is the crontab entry (in rmason's crontab):
0,15,30,45 * * * *      rmason /usr/bin/rsync -av /home/rmason backup_machine:my
machine_rmason

Thanks for the reply.  Unfortunately that did not work, the same error
ocurs.
This is what I have currently:
0,15,30,45 * * * *      /usr/bin/rsync -av -e "ssh" /home/rmason [EMAIL 
PROTECTED]:mymachine_rmason

I've tried with and without the quotes plus with and without the
rmason@ but none worked.

I think I'll try scp and see what happens.

Cheers,
Roger
--
[EMAIL PROTECTED] mailing list

Reply via email to