Last change
on this file since 395 was 346, checked in by Rick van der Zwet, 13 years ago |
Compress data during transfer.
|
-
Property svn:executable
set to
*
|
File size:
888 bytes
|
Line | |
---|
1 | #!/bin/sh
|
---|
2 | #
|
---|
3 | # $Id$
|
---|
4 | #
|
---|
5 | # Backup WebDAV and Subversion and Wiki
|
---|
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 |
|
---|
13 | DIRS=${2:-"drupal wiki webfolder svn"}
|
---|
14 | BACKUP_USER=${BACKUP_USER:-${3:-backup}}
|
---|
15 | SSH_KEY=${4:-/root/.ssh/backup.key}
|
---|
16 |
|
---|
17 | EXCLUDES=`dirname $0`/excludes
|
---|
18 |
|
---|
19 | DELETEROOT="/usr/backup/$HOSTID/wwwbackup/old"
|
---|
20 | MIRRORROOT="/usr/backup/$HOSTID/wwwbackup/current"
|
---|
21 |
|
---|
22 | BACKUPDIR=$DELETEROOT/`date '+%Y/%M/%d'`
|
---|
23 | OPTS="--force --ignore-errors --delete-excluded --compress
|
---|
24 | --delete --backup --backup-dir=$BACKUPDIR --archive"
|
---|
25 |
|
---|
26 |
|
---|
27 | if [ -r $EXCLUDES ]; then
|
---|
28 | OPTS="$OPTS --exclude-from=$EXCLUDES"
|
---|
29 | fi
|
---|
30 |
|
---|
31 |
|
---|
32 | for DIR in $DIRS; do
|
---|
33 | TARGET=$MIRRORROOT/$DIR
|
---|
34 | SOURCE=/usr/local/www/$DIR
|
---|
35 | mkdir -p $TARGET $BACKUPDIR
|
---|
36 |
|
---|
37 | # now the actual transfer
|
---|
38 | rsync --rsh="ssh -i $SSH_KEY -l $BACKUP_USER" $OPTS $FQDN:$SOURCE $TARGET
|
---|
39 | done
|
---|
Note:
See
TracBrowser
for help on using the repository browser.