Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

rsync script error



In addition, you would need multiple excludes:

--exclude ".snapshot"  -- exclude /mnt/external/. --exclude /data/biomicr=
o/external

Additionally, I don't particularly like to backup from root.  I would pre=
fer backing up explicit directories.=20
The --delete switch does not take an argument, and will delete files that=
 currently occur in the target but not in the source.=20
--exclude <excluded file or directory>   #excludes 1 file or directory Yo=
u can have multiple excludes
--delete-excluded                        #if an excluded file exists in t=
he target, delete it.=20
/usr/bin/rsync -avz --delete --delete-excluded  --exclude .snapshot  /mnt=
/external/ \
/data/biomicro/external | tee -a /var/log/rsync/backup.log \
| mail -s "back cron job external ran" sgoldman-3s7WtUTddSA at public.gmane.org

I changed the quotes around .snapshot as they are not needed. I removed t=
he dot (.) after /mnt/external.
This will copy the contents of /mnt/external to /data/biomicro/external, =
but it will not create and external subdirectory
It will delete any file on /data/biomicro/external that does not occur on=
 /mnt/external. It will exclude any directory named .snapshot that may oc=
cur in /mnt/external and will remove any .snapshot directory that might a=
lready be on your target. I use rsnapshot both at home and work, but I us=
ed to use rsync very extensively.=20

Additionally the mail command is being interpreted by rsync because you l=
eft out the |. Use the tee command to set up your log as well as pipe to =
mail.=20




On 12/12/2009 01:20 PM, Stephen Goldman wrote:
> Good afternoon Blu,
>     I 've been doing a hit and miss with a rsync script I wrote that is=
 not working.
>
>     Appreciate a review from more experience eyes and suggested referen=
ce -
>
>     RHEL system-Red Hat Enterprise Linux Server release 5.4 (Tikanga)
>
>
>     I have an NFS mount from a NET APP filer that is running ".snapshot=
s" of the directory mounted on
> /mnt/external -- wish to sync to /data/biomicro/external AND skip .snap=
shots - on mnt/external-=20
> send email message - script to be run from cron.daily=20
>
>
>
>    Combining the --delete and exclude statements is confusing.=20
>
>
> #!/bin/bash
> /usr/bin/rsync -avz --delete / --exclude ".snapshot"  /mnt/external/. /=
data/biomicro/external  >> /var/log/rsync/backup.log mail -s "back cron j=
ob external ran" sgoldman-3s7WtUTddSA at public.gmane.org
> ~
> When I test from /root   - I error out.=20
> ]
> rsync: -s: unknown option
> rsync error: syntax or usage error (code 1) at main.c(1231) [client=3D2=
=2E6.8]
> [root@ ~]#=20
>
>
>  =20

--=20
Jerry Feldman <gaf-mNDKBlG2WHs at public.gmane.org>
Boston Linux and Unix
PGP key id: 537C5846
PGP Key fingerprint: 3D1B 8377 A3C0 A5F2 ECBB  CA3B 4607 4319 537C 5846








BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org