hello,
i need to modified my synch/back scripts....
i want that this script only syncro folders in destinationfolder.
f.e. when in destination are two folders
1) admin
2) users
but in SOURCE are three:
1) admin
2) users
3) antivirus
the script should only increnmential sync the two from destinationfolder!
my script:
#!/bin/sh
MAILADDR=david@xyz.de
HOSTNAME=mothership
BACKUPDIR=directory_you_want_to_backup
EXCLUDES=example_exclude_file
ARCHIVEROOT=directory_to_backup_to
# directory which holds our current datastore
CURRENT=main
# directory which we save incremental changes to
INCREMENTDIR=`date +%Y-%m-%d`
# options to pass to rsync
OPTIONS="--force --ignore-errors --delete --delete-excluded \
--exclude-from=$EXCLUDES --backup --backup-dir=$ARCHIVEROOT/$INCREMENTDIR -av"
export PATH=$PATH:/bin:/usr/bin:/usr/local/bin
# make sure our backup tree exists
install -d $ARCHIVEROOT/$CURRENT
# our actual rsyncing function
do_rsync()
{
rsync $OPTIONS $BACKUPDIR $ARCHIVEROOT/$CURRENT
}
# our post rsync accounting function
do_accounting()
{
echo "Backup Accounting for Day $INCREMENTDIR on $HOSTNAME:">/tmp/rsync_script_tmpfile
echo >> /tmp/rsync_script_tmpfile
echo "################################################">>/tmp/rsync_script_tmpfile
du -s $ARCHIVEROOT/* >> /tmp/rsync_script_tmpfile
echo "Mail $MAILADDR -s $HOSTNAME Backup Report < /tmp/rsync_script_tmpfile"
Mail $MAILADDR -s $HOSTNAME Backup Report < /tmp/rsync_script_tmpfile
echo "rm /tmp/rsync_script_tmpfile"
rm /tmp/rsync_script_tmpfile
}
# some error handling and/or run our backup and accounting
if [ -f $EXCLUDES ]; then
if [ -d $BACKUPDIR ]; then
# now the actual transfer
do_rsync && do_accounting
else
echo "cant find $BACKUPDIR"; exit
fi
else
echo "cant find $EXCLUDES"; exit
fi