?

Log in

No account? Create an account

Previous Entry | Next Entry

Having trouble with a connection that drops out every 10 seconds? Wish you could restart the rsync process?

Here's how to do it.

First pop up a terminal window (ctrl+alt+T on the eeepc) and type "pico".

then type in the following script


./k; #this is a dummy command called k
# k will fail to execute
# which should set the $? variable to 1
while [ $? != 0 ]
#checks if the previous command executed correctly,
#if not does a loop
do # begin loop
rsync -avz --timeout=10 -e ssh /path/to/source/directory \
yourusername@your.linux.server.org:/path/to/destination/directory


#rsync will transfer only the files that have changed
#rsync will restart if there is no activity in 10 sec
done #end loop



save with ctrl+w, give it a name like backup.sh and exit

then remember to set up the script you wrote to chmod +x backup.sh


logging in using automatic login so you only type your password once

After that, set up automatic login to the server via unattended key-based authorization with SSH.

http://wp.uberdose.com/2006/10/16/ssh-automatic-login/

that's it. now the pain of a slow connection is automated away!

Comments

( 2 comments — Leave a comment )
parakleta
May. 7th, 2009 09:53 am (UTC)
you could just do instead:
until rsync ...args...
do
done
Don't know how to get rid of the
do; done
though. If you really want to set the return var to non-zero, you should call the program false (there are a programs true and false which exit with zero and non-zero return codes respectively). You should probably also add a
#!/bin/bash
or equivalent to the top of your script so it's shell agnostic (#! determines what will interpret the script).
thekit
May. 8th, 2009 02:20 am (UTC)
Thanks!

I didn't know about the program false.

the man page for false is oddly similar to my life:

"False - Do nothing, unsuccessfully."
( 2 comments — Leave a comment )

Latest Month

August 2015
S M T W T F S
      1
2345678
9101112131415
16171819202122
23242526272829
3031     

Page Summary

Powered by LiveJournal.com
Designed by Naoto Kishi