scripts

Aegir batch site backup script

Many Aegir users ask whether there is a way to schedule backups of all sites provisioned in Aegir. Currently at the time of writing, no such scheduling exists within Aegir itself, since we have a few design decisions to work out (such as where to store the backups, especially when multi-server comes in!)

For the meantime, here's a crude little shell script that might help you. You should execute it as the aegir user.

Backup of subversion repository

This script does an svn hotcopy of a subversion repository and then rsyncs it to an external location. Easy to script, nice trouble-free way of maintaining subversion backups.

#!/bin/bash
export RSYNC_RSH=/usr/bin/ssh

# some variables in case they change later
server=destination.com # where we are sending the backup to
user=miguel
tempcopy=/home/${user}/svnbackup
dest=/media/disk/svnserver/svnbackup

# example svn repository
# make the backup with svnadmin hotcopy
svnadmin hotcopy /data1/svn/repo/ ${tempcopy}/repo/

# rsync it to the external hard drive on my desk
rsync -aHPvz ${tempcopy}/repo/ "${user}@${server}:${dest}/repo/"

# finally, remove the backup on svnserver to free up some space
rm -rf ${tempcopy}/repo

Hourly database backup

#!/bin/bash
DATE=`date +%H`
FILENAME=$1/$1_hourly_$DATE.sql
mkdir -p $1
pg_dump -cxO -f $FILENAME $1
gzip -f $FILENAME
echo $FILENAME

Pages

Subscribe to RSS - scripts