Current time: 11-22-2024, 02:06 PM Hello There, Guest! (LoginRegister)


Post Reply 
Server Backup Strategies Imaging & tarballs
Author Message
ShinZan Offline
Junior Member
*

Posts: 43
Joined: Aug 2008
Reputation: 0
Post: #12
RE: Server Backup Strategies Imaging & tarballs
(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
(This post was last modified: 03-24-2012 07:13 AM by ShinZan.)
03-24-2012 03:41 AM
Find all posts by this user Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Server Backup Strategies Imaging & tarballs - ShinZan - 03-24-2012 03:41 AM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)