openmamba-headserver-tools/etc-frontend/cron.weekly/10-openmamba-backup

24 lines
859 B
Plaintext
Raw Normal View History

2012-03-12 15:18:41 +01:00
#!/bin/bash
SNAPDATE=`date +%Y%m%d`
TMPDIR=`mktemp -d`
MYSQL_USER=
MYSQL_PASSWORD=
echo "Creating www sites backup archives..."
tar cjf $TMPDIR/openmamba-www-backup-$SNAPDATE.tar.bz2 /var/www/www.openmamba.org/
tar cjf $TMPDIR/openmamba-wiki-backup-$SNAPDATE.tar.bz2 /var/www/wiki.openmamba.org/
tar cjf $TMPDIR/openmamba-forum-backup-$SNAPDATE.tar.bz2 /var/www/forum.openmamba.org/
tar cjf $TMPDIR/openmamba-bugs-backup-$SNAPDATE.tar.bz2 /var/www/bugs.openmamba.org/
echo "Creating openmamba database dump..."
mysqldump -u $MYSQL_USER --password="$MYSQL_PASSWORD" openmamba > $TMPDIR/openmamba-mysql.dump
echo "Creating /etc backup..."
tar cjf $TMPDIR/openmamba-etc-backup-$SNAPDATE.tar.bz2 /etc
echo "Creating final global archive..."
cd $TMPDIR
tar cjvf /root/openmamba-server-backup-$SNAPDATE.tar.bz2 * || exit 1
cd ..
[ "$TMPDIR" ] && rm -rf $TMPDIR