Pages

Sunday, February 6, 2011

rsync and retain root/other_user attributes


~/bin/sync





#!/bin/bash
# add the following line to /etc/sudoers in the remote system
# username ALL = NOPASSWD: /usr/bin/rsync
for myhost in asus dev x30 t60
do
ping -c 1 "$myhost" > /dev/null
if [ "$?" -eq 0 ] ; then
echo "$myhost up"
sudo rsync -Pha --delete --rsync-path="sudo rsync" --ignore-errors ~/common-files $USER@$myhost:
else
echo "$myhost down"
fi
done





--
My Emacs Files At GitHub

No comments:

Post a Comment