Date: Sun, 19 Mar 2006 14:55:18 -0700 From: "Pat Maddox" <pergesu@gmail.com> To: "FreeBSD Questions" <freebsd-questions@freebsd.org> Subject: rsync script not excluding dirs Message-ID: <810a540e0603191355n3e86fe15pa15a24da1a48dce8@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
I have a backup script that runs nightly, and I want it to exclude
certain dirs (ports, obj, etc). However when I run the script it
doesn't exclude anything, leaving me with pretty massive backups.=20
Here's the entire script.
/, /var, /usr, and /backup are all on different partitions. The key
part is at the bottom where it calls rsync and excludes dirs. Can
someone tell me what's wrong with the script?
Pat
#!/bin/sh
HOME=3D/
PATH=3D/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
export HOME PATH STAGE DAY MONTH YEAR DAY2 DAY1 PERMS SVR PRE ARG
PERMS=3D`date +%Y%m%d`
SVR=3D"cantona"
# forward dating
DAY1=3D`date +%Y/${SVR}/%m/%d`
# reverse dating for removal of old backup
DAY2=3D`date -j -v-1w +%Y/${SVR}/%m/%d`
PRE=3D"/usr/local/bin/rsync"
ARG=3D`ps -ax | grep ${PRE} | grep -v grep | wc -l | awk '{ print $1 }'`
if [ $ARG -gt 0 ]; then
echo "$PRE is running"
return $?
fi
# Remount the filesystem for writing
mount -u -o rw /backup
# snapshot of the perms
ls -lRafh /* > /backup/perms_snaps/${PERMS}.${SVR}.perms.snap
tar -czf /backup/perms_snaps/${PERMS}.${SVR}.perms.snap.tar.gz
/backup/perms_snaps/${PERMS}.${SVR}.perms.snap
rm /backup/perms_snaps/${PERMS}.${SVR}.perms.snap
chmod 400 /backup/perms_snaps/*
# create the backup dirs for the day/week/year
mkdir -p /backup/${DAY1}/
# rm the old backups
rm -rf /backup/${DAY2}
${PRE} -bapoguLxSRC --exclude=3D*.core --exclude=3D*~* / --exclude=3D/dev
--exclude=3D/backup /backup/${DAY1}/
${PRE} -bapoguLxSRC --exclude=3D*.core --exclude=3D*~* /var /backup/${DAY1}=
/
${PRE} -bapoguLxSRC --exclude=3D*.core --exclude=3D*~* --exclude=3D/usr/src
--exclude=3D/usr/ports --exclude=3D/usr/obj /usr /backup/${DAY1}/
# Make the file system read only again
mount -u -o ro /backup
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?810a540e0603191355n3e86fe15pa15a24da1a48dce8>
