Last change
on this file since 354 was 346, checked in by Rick van der Zwet, 13 years ago |
Compress data during transfer.
|
-
Property svn:executable
set to
*
|
File size:
790 bytes
|
Rev | Line | |
---|
[343] | 1 | #!/bin/sh
|
---|
| 2 | #
|
---|
| 3 | # $Id$
|
---|
| 4 | #
|
---|
| 5 | # Sync the snapshot files to the local archive
|
---|
| 6 | #
|
---|
| 7 | # Rick van der Zwet <info@rickvanderzwet.nl>
|
---|
| 8 |
|
---|
| 9 |
|
---|
| 10 | FQDN=${1:-tyan.wirelessleiden.nl}
|
---|
| 11 | HOSTID=`echo $FQDN | awk -F "." '{print $1}'`
|
---|
| 12 |
|
---|
[345] | 13 | DIRS=${2:-"configbackup mysqlbackup"}
|
---|
| 14 | BACKUP_USER=${BACKUP_USER:-${3:-backup}}
|
---|
| 15 | SSH_KEY=${4:-/root/.ssh/backup.key}
|
---|
[343] | 16 |
|
---|
| 17 | EXCLUDES=`dirname $0`/excludes
|
---|
| 18 |
|
---|
| 19 | SNAPSHOTROOT="/usr/backup/$HOSTID"
|
---|
| 20 |
|
---|
| 21 | # Deleting will be done manually to avoid whipe-outs.
|
---|
[346] | 22 | OPTS="--force --ignore-errors --archive --compress"
|
---|
[343] | 23 |
|
---|
| 24 |
|
---|
| 25 | if [ -r $EXCLUDES ]; then
|
---|
| 26 | OPTS="$OPTS --exclude-from=$EXCLUDES"
|
---|
| 27 | fi
|
---|
| 28 |
|
---|
| 29 |
|
---|
| 30 | for DIR in $DIRS; do
|
---|
| 31 | TARGET=$SNAPSHOTROOT/$DIR
|
---|
| 32 | SOURCE=/usr/backup/$HOSTID/$DIR
|
---|
[344] | 33 | mkdir -p $TARGET || exit 1
|
---|
[343] | 34 |
|
---|
| 35 | # now the actual transfer
|
---|
| 36 | rsync --rsh="ssh -i $SSH_KEY -l $BACKUP_USER" $OPTS $FQDN:$SOURCE $TARGET
|
---|
| 37 |
|
---|
| 38 | done
|
---|
Note:
See
TracBrowser
for help on using the repository browser.