(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
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