BAD rsync, or is it bad me?
Wesley Joyce
wjoyce at uvi.edu
Wed Dec 31 11:35:11 EST 2003
Something very scary just happened to me while I was creating a ksh script
to rsync mulitple FS between two hosts. Here is the script, notice the 'i'
at the end of rsync line, it got put there by mistake. You also see the
contents of $FSLIST cat'd below the script. When I ran this, it started to
delete files in root's home directory and place files from the fist FS,
/banner, into root's home directory. The resolved rsync line in the first
instance would have been...
rsync -vaz -e "ssh" --delete --exclude-from=/usr/local/adm/rsync.exclude
/banner/ backenp650:/banneri
When I ran it, the output began like this
building file list ... done
deleting sysback/C480KIE.tar
deleting directory sysback
deleting stuff/user/usermigrate2.ksh
deleting stuff/user/rmuserdir.ksh
deleting stuff/user/rmuser.ksh
deleting stuff/user/mkuser5.ksh
deleting stuff/user/mkuser4.ksh
deleting stuff/user/mkuser3.ksh
deleting stuff/user/mkuser2.ksh
deleting stuff/user/mkuser1.ksh
So I immediately pressed ctrl-c and began restoring my files! :) Did it
default to $HOME or ~ because the destination directory did not exist
(/banneri) or did I miss something in my observation?
"rsyncall.ksh" 15 lines, 449 characters
#rsyncall.ksh
#rsyncs all fs listed in $FSLIST from localhost to $DHOST
FSLIST=/usr/local/adm/rsync.fslist
SHOST=`hostname`
DHOST=backenp650
date
for FS in $(cat $FSLIST);
do
echo "rsync'ing $FS from $SHOST to $DHOST"
rsync -vaz -e "ssh" --delete --exclude-from=/usr/local/adm/rsync.exclude
$FS/ $DHOST:$FSi
echo "\n"
done
- END SCRIPT -
cat /usr/local/adm/rsync.fslist
/banner
/banproc
/bantest
/bantemp
/users
-------------- next part --------------
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.556 / Virus Database: 348 - Release Date: 12/26/2003
More information about the rsync
mailing list