a question of backup
Gustav H Meyer
gustav at gcis.gov.za
Mon Feb 27 08:14:25 UTC 2006
Hi Gabriel,
On 26/02/06 09:03, Gabriel Dragffy wrote:
> ...If someone is able to write me an example script for its
> execution in creating a fast mirror back up (i.e. only copied
> changed/new files and deletes others NOT recopying everything)
> I'd really appreciate it.
A quick script using rsync with ssh:
1 #!/bin/sh
2 # mirror - Mirror files from RemoteServers to LocalServer
3 LOGFILE=/data/logs/mirror/`date +%Y%m%d%H%M%S`.log
4 # Limit the bandwidth on a slow / busy network
5 BWLIMIT=256
6 RSYNC="/usr/local/bin/rsync -avze /usr/bin/ssh
--bwlimit=$BWLIMIT --delete"
7 LocalDir=/data/backups/servers
8 echo Start: `date`
9 echo LogFile: $LOGFILE
10 # Start a new logfile
11 echo Starting at: `date` > $LOGFILE
12 echo RemoteServerA >> $LOGFILE
13 $RSYNC RemoteServerA:/src/dir/
$LocalDir/RemoteServerA/dst/dir >> $LOGFILE
14 echo RemoteServerB >> $LOGFILE
15 $RSYNC --exclude 'logs/' RemoteServerB:/src/dir/
$LocalDir/RemoteServerB/dst/dir >> $LOGFILE
16 echo >> $LOGFILE
17 echo Ending at: `date` >> $LOGFILE
18 echo Stop: `date`
Regards,
Gustav H Meyer
More information about the kubuntu-users
mailing list