Greetings. I wrote a script that make remote backups with rsync. I have 2 main problems with it 1) I want that the destination directory (on the repository machine) recreate the backed up file path and it permission (I use -R here ) 2) Is there a way to "follow" all the links using -R and -a parameters..?? Currently I am using something like this. rsync -al --delete --copy-unsafe-links --rsh=/usr/bin/ssh -R --delete-excluded -vv --delete /etc/* root@127.0.0.1:/usr/local/src/ Lokk ath some part of the output copying unsafe symlink "/etc/php4/lib" -> "/usr/lib/apache-extramodules" copying unsafe symlink "/etc/rmt" -> "/usr/sbin/rmt" copying unsafe symlink "/etc/runlevels/boot/keymaps" -> "/etc/init.d/keymaps" copying unsafe symlink "/etc/runlevels/boot/clock" -> "/etc/init.d/clock" copying unsafe symlink "/etc/runlevels/boot/localmount" -> "/etc/init.d/localmount" copying unsafe symlink "/etc/runlevels/boot/consolefont" -> "/etc/init.d/consolefont" copying unsafe symlink "/etc/runlevels/boot/modules" -> "/etc/init.d/modules" copying unsafe symlink "/etc/runlevels/boot/hostname" -> "/etc/init.d/hostname" copying unsafe symlink "/etc/runlevels/boot/net.lo" -> "/etc/init.d/net.lo" copying unsafe symlink "/etc/runlevels/boot/serial" -> "/etc/init.d/serial" copying unsafe symlink "/etc/runlevels/boot/urandom" -> "/etc/init.d/urandom" copying unsafe symlink "/etc/runlevels/boot/checkroot" -> "/etc/init.d/checkroot" copying unsafe symlink "/etc/runlevels/boot/rmnologin" -> "/etc/init.d/rmnologin" copying unsafe symlink "/etc/runlevels/boot/bootmisc" -> "/etc/init.d/bootmisc" copying unsafe symlink "/etc/runlevels/boot/checkfs" -> "/etc/init.d/checkfs" copying unsafe symlink "/etc/runlevels/default/gpm" -> "/etc/init.d/gpm" copying unsafe symlink "/etc/runlevels/default/local" -> "/etc/init.d/local" copying unsafe symlink "/etc/runlevels/default/named" -> "/etc/init.d/named" copying unsafe symlink "/etc/runlevels/default/net.eth0" -> "/etc/init.d/net.eth0" copying unsafe symlink "/etc/runlevels/default/sysklogd" -> "/etc/init.d/sysklogd" copying unsafe symlink "/etc/runlevels/default/netmount" -> "/etc/init.d/netmount" copying unsafe symlink "/etc/runlevels/nonetwork/local" -> "/etc/init.d/local" and if I see /etc on the source server s -la /etc/runlevels/default/ total 1 drwxr-xr-x 2 root root 216 Feb 12 21:02 . drwxr-xr-x 6 root root 152 Dec 3 11:45 .. -rw-r--r-- 1 root root 0 Dec 4 06:51 .keep lrwxrwxrwx 1 root root 15 Feb 9 16:39 gpm -> /etc/init.d/gpm lrwxrwxrwx 1 root root 17 Dec 31 1998 local -> /etc/init.d/local lrwxrwxrwx 1 root root 17 Feb 12 21:02 named -> /etc/init.d/named lrwxrwxrwx 1 root root 20 Dec 31 1998 net.eth0 -> /etc/init.d/net.eth0 lrwxrwxrwx 1 root root 20 Dec 31 1998 netmount -> /etc/init.d/netmount lrwxrwxrwx 1 root root 20 Dec 31 1998 sysklogd -> /etc/init.d/sysklogd and on the /etc/ directory on the destination ls -la runlevels/default/ total 25 drwxr-xr-x 2 root root 216 Feb 12 21:02 . drwxr-xr-x 6 root root 152 Dec 3 11:45 .. -rw-r--r-- 1 root root 0 Dec 4 06:51 .keep -rwxr-xr-x 1 root root 958 Feb 8 23:12 gpm -rwxr-xr-x 1 root root 727 Dec 4 06:51 local -rwxr-xr-x 1 root root 1378 Feb 11 21:00 named -rwxr-xr-x 1 root root 3669 Dec 4 06:51 net.eth0 -rwxr-xr-x 1 root root 2580 Dec 4 06:51 netmount -rwxr-xr-x 1 root root 962 Dec 31 1998 sysklogd Is there a way to maintain the simlinks that the source server have..?? I should use the -R flag to maintain the source server directory structure on the storage server... Thanks a lot
On Fri, Feb 21, 2003 at 12:15:59PM -0400, Carlos Molina Garcia wrote:> Greetings. > > I wrote a script that make remote backups with rsync. I have 2 main > problems with it > > 1) I want that the destination directory (on the repository machine) > recreate the backed up file path and it permission (I use -R here ) > > 2) Is there a way to "follow" all the links using -R and -a parameters..?? > > Currently I am using something like this. > > rsync -al --delete --copy-unsafe-links --rsh=/usr/bin/ssh -R > --delete-excluded -vv --delete /etc/* root@127.0.0.1:/usr/local/src/What you want is not /etc/* but /etc or /etc/ With /etc it will copy the /etc directory (and you won't in this case need -R. With /etc/ it copies all the contents of /etc but not the directory itself and you will want -R or add etc to the destination path. Do a echo /etc/* to see what the shell is putting on the command line to rsync. [snip]> > and if I see /etc on the source server > s -la /etc/runlevels/default/ > total 1 > drwxr-xr-x 2 root root 216 Feb 12 21:02 . > drwxr-xr-x 6 root root 152 Dec 3 11:45 .. > -rw-r--r-- 1 root root 0 Dec 4 06:51 .keep > lrwxrwxrwx 1 root root 15 Feb 9 16:39 gpm -> > /etc/init.d/gpm > lrwxrwxrwx 1 root root 17 Dec 31 1998 local -> > /etc/init.d/local > lrwxrwxrwx 1 root root 17 Feb 12 21:02 named -> > /etc/init.d/named > lrwxrwxrwx 1 root root 20 Dec 31 1998 net.eth0 -> > /etc/init.d/net.eth0 > lrwxrwxrwx 1 root root 20 Dec 31 1998 netmount -> > /etc/init.d/netmount > lrwxrwxrwx 1 root root 20 Dec 31 1998 sysklogd -> > /etc/init.d/sysklogdAbsolute paths all. Now reread the manpage --copy-unsafe-links This tells rsync to copy the referent of symbolic links that point outside the source tree. Absolute symlinks are also treated like ordinary files, and so are any symlinks in the source path itself when --relative is used. Change all those symlinks to to relative and make the above change and it will do as you want. [snip]> Is there a way to maintain the simlinks that the source server have..??Yes, don't use --copy-unsafe-links but do use --links which is included in -a. That may produce a few links that point nowhere or that point to non-backup files on the local system.> I should use the -R flag to maintain the source server directory > structure on the storage server...How you do that is up to you. Oh, the term is symlinks, not simlinks. It is short for symbolic link :) -- ________________________________________________________________ J.W. Schultz Pegasystems Technologies email address: jw@pegasys.ws Remember Cernan and Schmitt