source: tools/www-backup.sh@ 404

Last change on this file since 404 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
RevLine 
[343]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
10FQDN=${1:-tyan.wirelessleiden.nl}
11HOSTID=`echo $FQDN | awk -F "." '{print $1}'`
12
[345]13DIRS=${2:-"drupal wiki webfolder svn"}
14BACKUP_USER=${BACKUP_USER:-${3:-backup}}
15SSH_KEY=${4:-/root/.ssh/backup.key}
[343]16
17EXCLUDES=`dirname $0`/excludes
18
19DELETEROOT="/usr/backup/$HOSTID/wwwbackup/old"
20MIRRORROOT="/usr/backup/$HOSTID/wwwbackup/current"
21
22BACKUPDIR=$DELETEROOT/`date '+%Y/%M/%d'`
[346]23OPTS="--force --ignore-errors --delete-excluded --compress
[343]24 --delete --backup --backup-dir=$BACKUPDIR --archive"
25
26
27if [ -r $EXCLUDES ]; then
28 OPTS="$OPTS --exclude-from=$EXCLUDES"
29fi
30
31
32for 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
39done
Note: See TracBrowser for help on using the repository browser.