Pages

Monday, January 31, 2011

Using rsync to synchronise different machines over ssh

#!/bin/bash
# January 2011 : rsync to various machines.
# author : rileyrg@gmail.com
# The LOCALHOST machine should have itself in the
# /etc/hosts files as something lile 1.1.1 so that
# the ping fails : basically a check to see if the
# destination host is available.
for myhost in asus dev x30 t60
do
ping -c 1 "$myhost" > /dev/null
if [ "$?" -eq 0 ] ; then
echo "$myhost up"
rsync -avz --delete ~/common-files $myhost:
else
echo "$myhost down"
fi
done




--
My Emacs Files At GitHub

No comments:

Post a Comment