Index: /tools/config-snapshot.sh
===================================================================
--- /tools/config-snapshot.sh	(revision 343)
+++ /tools/config-snapshot.sh	(revision 343)
@@ -0,0 +1,36 @@
+#!/bin/sh
+#
+# $Id$
+#
+# The $BACKUPROOT needs to be rsynced to an other system. 
+#
+# Poor mans configuration backup. Only save the new backup if configuration
+# content changes
+#
+# Rick van der Zwet <info@rickvanderzwet.nl>
+
+TAG=`date "+%Y%m%d.%H:%M"`
+
+BACKUPROOT=/usr/backup/`hostname -s`/configbackup
+TARGET=$BACKUPROOT/config-$TAG.tar
+
+# Check for last backup file
+mkdir -p $BACKUPROOT
+LAST=`ls -t1 $BACKUPROOT/*.tar | head -1`
+
+if [ "$LAST" = "$TARGET" ]; then
+  echo "# Error file '$TARGET' does already exists" 1>&2
+  exit 1
+fi
+
+# Create new backup file
+tar -C / -cf $TARGET etc usr/local/etc var/db/pkg 2>&1
+
+# If old file this exists, only keep new files if changes exists
+if [ -n "$LAST" ]; then
+  PREV_MD5=`md5 -q $LAST`
+  NEW_MD5=`md5 -q $TARGET`
+  if [ "$PREV_MD5" = "$NEW_MD5" ]; then
+    rm $TARGET
+  fi
+fi
Index: ols/etcbackup.sh
===================================================================
--- /tools/etcbackup.sh	(revision 342)
+++ 	(revision )
@@ -1,33 +1,0 @@
-#!/bin/sh
-#
-# $Id$
-# Poor mans configuration backup. Only save the new backup if configuration
-# content changes
-#
-# Rick van der Zwet <info@rickvanderzwet.nl>
-
-TAG=`date "+%Y%m%d.%H:%M"`
-
-BACKUPROOT=/usr/local/backup/config
-TARGET=$BACKUPROOT/etc-$TAG.tar
-
-# Check for last backup file
-mkdir -p $BACKUPROOT
-LAST=`ls -t1 /usr/local/backup/config/etc-*.tar | head -1`
-
-if [ "$LAST" = "$TARGET" ]; then
-  echo "# Error file '$TARGET' does already exists" 1>&2
-  exit 1
-fi
-
-# Create new backup file
-tar -C / -cf $TARGET etc usr/local/etc 2>&1
-
-# If old file this exists, only keep new files if changes exists
-if [ -n "$LAST" ]; then
-  PREV_MD5=`md5 -q $LAST`
-  NEW_MD5=`md5 -q $TARGET`
-  if [ "$PREV_MD5" = "$NEW_MD5" ]; then
-    rm $TARGET
-  fi
-fi
Index: /tools/mysql-snapshot.sh
===================================================================
--- /tools/mysql-snapshot.sh	(revision 343)
+++ /tools/mysql-snapshot.sh	(revision 343)
@@ -0,0 +1,21 @@
+#!/bin/sh
+#
+# $Id: mysqlbackup.sh 8624 2010-10-31 23:16:34Z rick $
+# Poor mans mysql database backup.
+# Rick van der Zwet <info@rickvanderzwet.nl>
+
+
+BACKUP_ROOT="/usr/backup/`hostname -s`/mysqlbackup"
+MYSQL_AUTH=`cat /root/.mysql_root_auth` || exit 1
+export PATH=$PATH:/usr/local/bin
+
+# All available database
+DATABASES=`echo 'show databases' | mysql --skip-column-names $MYSQL_AUTH`
+
+BACKUP_TODAY=`date "+$BACKUP_ROOT/%Y/%m/%d/"`
+mkdir -p $BACKUP_TODAY
+# Dump and compress
+for DATABASE in $DATABASES; do
+  TIMETAG=`date "+%H:%M:%S"`
+  mysqldump $MYSQL_AUTH --skip-lock-tables $DATABASE | gzip > $BACKUP_TODAY/$DATABASE-$TIMETAG.sql.gz
+done
Index: ols/mysqlbackup.sh
===================================================================
--- /tools/mysqlbackup.sh	(revision 342)
+++ 	(revision )
@@ -1,22 +1,0 @@
-#!/bin/sh
-#
-# $Id$
-# Poor mans mysql database backup.
-# Rick van der Zwet <info@rickvanderzwet.nl>
-
-
-BACKUP_ROOT='/usr/local/backup/mysqlbackup'
-MYSQL_AUTH='-uroot'
-export PATH=$PATH:/usr/local/bin
-
-# All available database
-DATABASES=`echo 'show databases' | mysql --skip-column-names $MYSQL_AUTH`
-
-BACKUP_TODAY=`date "+$BACKUP_ROOT/%Y/%m/%d/"`
-mkdir -p $BACKUP_TODAY
-# Dump and compress
-for DATABASE in $DATABASES; do
-  TIMETAG=`date "+%H:%M:%S"`
-  mysqldump $MYSQL_AUTH --skip-lock-tables $DATABASE | gzip > $BACKUP_TODAY/$DATABASE-$TIMETAG.sql.gz
-done
-
Index: /tools/snapshot-sync.sh
===================================================================
--- /tools/snapshot-sync.sh	(revision 343)
+++ /tools/snapshot-sync.sh	(revision 343)
@@ -0,0 +1,38 @@
+#!/bin/sh
+#
+# $Id$
+#
+# Sync the snapshot files to the local archive
+#
+# Rick van der Zwet <info@rickvanderzwet.nl>
+
+
+FQDN=${1:-tyan.wirelessleiden.nl}
+HOSTID=`echo $FQDN | awk -F "." '{print $1}'`
+
+BACKUP_USER=${BACKUP_USER:-${2:-backup}}
+SSH_KEY=${3:-/root/.ssh/backup.key}
+DIRS=${4:-"configbackup mysqlbackup"}
+
+EXCLUDES=`dirname $0`/excludes
+
+SNAPSHOTROOT="/usr/backup/$HOSTID"
+
+# Deleting will be done manually to avoid whipe-outs.
+OPTS="--force --ignore-errors --archive"
+
+
+if [ -r $EXCLUDES ]; then
+  OPTS="$OPTS --exclude-from=$EXCLUDES"
+fi
+
+
+for DIR in $DIRS; do
+  TARGET=$SNAPSHOTROOT/$DIR
+  SOURCE=/usr/backup/$HOSTID/$DIR
+  mkdir -p $TARGET
+
+  # now the actual transfer
+  rsync --rsh="ssh -i $SSH_KEY -l $BACKUP_USER" $OPTS $FQDN:$SOURCE $TARGET
+      
+done
Index: /tools/vmail-snapshot.sh
===================================================================
--- /tools/vmail-snapshot.sh	(revision 343)
+++ /tools/vmail-snapshot.sh	(revision 343)
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# $Id$
+# Poor mans virtual mailbox backup.
+# Rick van der Zwet <info@rickvanderzwet.nl>
+
+
+TARGET=/usr/backup/`host -s`/vmailbackup/virtual.tar.gz
+mkdir -p $TARGET
+tar -C /var/mail -czf $TARGET virtual
+
Index: ols/vmailbackup.sh
===================================================================
--- /tools/vmailbackup.sh	(revision 342)
+++ 	(revision )
@@ -1,10 +1,0 @@
-#!/bin/sh
-#
-# $Id$
-# Poor mans virtual mailbox backup.
-# Rick van der Zwet <info@rickvanderzwet.nl>
-
-
-TARGET=/usr/local/backup/vmailbackup/virtual.tar.gz
-tar -C /var/mail -czf $TARGET virtual
-
Index: /tools/www-backup.sh
===================================================================
--- /tools/www-backup.sh	(revision 343)
+++ /tools/www-backup.sh	(revision 343)
@@ -0,0 +1,39 @@
+#!/bin/sh
+#
+# $Id$
+#
+# Backup WebDAV and Subversion and Wiki
+#
+# Rick van der Zwet <info@rickvanderzwet.nl>
+
+
+FQDN=${1:-tyan.wirelessleiden.nl}
+HOSTID=`echo $FQDN | awk -F "." '{print $1}'`
+
+BACKUP_USER=${BACKUP_USER:-${2:-backup}}
+SSH_KEY=${3:-/root/.ssh/backup.key}
+DIRS=${4:-"drupal wiki webfolder svn"}
+
+EXCLUDES=`dirname $0`/excludes
+
+DELETEROOT="/usr/backup/$HOSTID/wwwbackup/old"
+MIRRORROOT="/usr/backup/$HOSTID/wwwbackup/current"
+
+BACKUPDIR=$DELETEROOT/`date '+%Y/%M/%d'`
+OPTS="--force --ignore-errors --delete-excluded 
+      --delete --backup --backup-dir=$BACKUPDIR --archive"
+
+
+if [ -r $EXCLUDES ]; then
+  OPTS="$OPTS --exclude-from=$EXCLUDES"
+fi
+
+
+for DIR in $DIRS; do
+  TARGET=$MIRRORROOT/$DIR
+  SOURCE=/usr/local/www/$DIR
+  mkdir -p $TARGET $BACKUPDIR
+
+  # now the actual transfer
+  rsync --rsh="ssh -i $SSH_KEY -l $BACKUP_USER" $OPTS $FQDN:$SOURCE $TARGET
+done
