rsync script mis-cue ??

Todd Zullinger tmz at pobox.com
Tue Jun 5 17:38:52 UTC 2007


William Case wrote:
> I have the following script I have been using for backing up:
> I just added the rsync -auH /etc/* /backup/etc line now to the script,
> to backup in preparation for installing FC7. /backup/ is a properly
> partitioned and mounted secondary hard disk.
> 
> I have the following home directory:
> ls -l /home/bill (with individual files removed) is:
> drwxr-xr-x  3 bill bill   4096 May 28 12:32 Desktop
> lrwxrwxrwx  1 bill bill     23 Mar 30  2006 Docs
> -> /home/bill/Desktop/Docs
> drwxr-xr-x  3 bill bill  36864 Dec 25 10:54 icons
> drwx------  2 bill bill   4096 Mar  9 23:04 Mail
> drwxr-xr-x  2 bill bill   4096 Dec  5 18:39 Music
> drwxrwxr-x 18 bill bill   4096 May 27 10:23 OclugRepo
> drwxr-xr-x  2 bill bill   4096 May 14 09:55 Templates
> drwxr-xr-x  2 bill bill   4096 Nov  6  2006 Wallpaper
> 
> ]$ FullBU
> #! FullBU
> ....
> if [ "$?" = 0 ]; then
> rsync -auH  /home/bill/* /backup/bill
> rsync -auH /etc/* /backup/etc
> fi
> ...
> 
> I just did a visual check and discovered that none of my dot files had
> been backed up; some /home/bill directories were not copied
> (icons,Mail,Music,OclugRepo,Templates); and, the /etc/* line did
> nothing.
> 
> I have re-read 'man' rsync and believe that the script should work.
> 
> Can anyone offer me any suggestions about what I have done wrong?

I'm not sure why the dirs in /home/bill weren't copied, but for the .
files and dirs, it's most likely because * doesn't match them.  There
are a few ways to handle that.  The simplest one to me is to change
the rsync command like so:

    rsync -auH  /home/bill/ /backup/bill/

The trailing / on the destination changes the way rsync treats it.  It
should sync everything in /home/bill to /backup/bill.  This is one of
the more confusing things about rsync to me. :)

Another way of doing this would be to tell the shell that * should
match . files.  You can do this with the dotglob shell option:

    shopt -s dotglob

-- 
Todd        OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Now I'm finding truth is a ruin
Nauseous end that nobody is pursuing

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 542 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20070605/74e4a159/attachment-0001.sig>


More information about the fedora-list mailing list