ispCP - Board - Support
Server Backup Strategies Imaging & tarballs - Printable Version

+- ispCP - Board - Support (http://www.isp-control.net/forum)
+-- Forum: ispCP Omega Support Area (/forum-30.html)
+--- Forum: Usage (/forum-34.html)
+--- Thread: Server Backup Strategies Imaging & tarballs (/thread-15866.html)

Pages: 1 2


RE: Server Backup Strategies Imaging & tarballs - ephigenie - 03-14-2012 04:52 PM

@ShinZan if you want to help improving & programming on the backup part of ispCP ... you're most welcome Smile


RE: Server Backup Strategies Imaging & tarballs - ShinZan - 03-24-2012 03:41 AM

(03-14-2012 04:52 PM)ephigenie Wrote:  @ShinZan if you want to help improving & programming on the backup part of ispCP ... you're most welcome Smile

Don't mind if I do: This might make a good wiki article:

Code:
#!/bin/bash
#Change These Vars to suit your needs

BACKUPDIR='/media/Flash'
DIR='backup'
DATE=`date +%a-%d-%b-%Y-%I%M%S-%p-%Z`
SERVER=`uname -n`
DBUSER='root'
DBPASS='yourrootpasswordhere'

#BEGIN

echo "Starting backup for $SERVER..."

mkdir -p $BACKUPDIR/$DIR/$DATE

# System Files Backup

echo "Backing up maillogconvert.pl ..."
cp /usr/sbin/maillogconvert.pl $BACKUPDIR/$DIR/$DATE/

echo "Dumping $SERVER MySQL databases files..."
mysqldump -u $DBUSER -p$DBASS --all-databases > /var/lib/mysql/alldatabases.sql

echo "Backing up $SERVER /etc..."
tar -cvzPf $BACKUPDIR/$DIR/$DATE/$DATE-$SERVER-etc.tar.gz /etc

echo "Backing up $SERVER /var/ (logs and www mail and ispcp) ..."
tar -cvzPf $BACKUPDIR/$DIR/$DATE/$DATE-$SERVER-var.tar.gz /var/

echo "Backing up $SERVER /root..."
tar -cvzPf $BACKUPDIR/$DIR/$DATE/$DATE-$SERVER-root.tar.gz /root

echo "Backing up $SERVER MySQL configuration files..."
tar -cvzPf $BACKUPDIR/$DIR/$DATE/$DATE-$SERVER-mysql.tar.gz /var/lib/mysql

echo "This script has super cow powers"

This backs up more than you *NEED* but you can tweak it suit your own tastes and of course the /var directory by itself can get big so dont try to back this up to FAT32 devices or youll hit the 4gb limit pretty easily im sure.

David