Thread: Server Backups
View Single Post


Old
  Post #30 (permalink)   01-03-2011, 07:54 PM
ughosting
HD Amateur
 
Join Date: Jan 2011
Location: London
Posts: 69

Status: ughosting is offline
You don't say which control panel you are using.

DirectAdmin is pretty good for doing backups itself, are the servers yours, or a hosts.

R1Soft is good, if you want to bare metal restore, but if you are renting, rather than co-locating your servers, then your host should be able to reinstall the OS with a KickStart server or similar.

As handsonhosting said earlier, if you rsync /var you should be getting the mysql databases as they sit in /var/lib/mysql by default.

I have some scripts for backing up your vhosts and mysql.

These are for "plesk-alike" boxes but you can change /var/ww/vhosts to /home

Backup Home Directories

#!/bin/bash

$DEST_IP=”10.10.10.10″

SOURCE_DIR=”/var/www/vhosts”
DEST_DIR=”/backups”
ARCHIVE_DIR=”archives”

clear

echo “Starting Archiving…”
echo

for i in $(find ${SOURCE_DIR} -type d -name httpdocs)
do

echo “Starting $(date)”

echo “Archiving ${i}”

echo “To ${DEST_DIR}/${ARCHIVE_DIR}/$(date +%y%m%d)$(echo ${i} | sed ‘s/\//./g’).tgz”

tar zcf ${DEST_DIR}/${ARCHIVE_DIR}/$(date +%y%m%d)$(echo ${i}| sed ‘s/\//./g’).tgz ${i}
echo “Completed $(date)”

echo

done


BACKUP MYSQL

#!/bin/bash

MYSQL_DIR=”/var/lib/mysql”

MYSQL_DUMPS=”/archives”

DB_ACCOUNT=”root”

DB_PASSWORD=”password”

echo “Dumping databases”

for i in $(find ${MYSQL_DIR} -type d -exec basename {} \

do

case ${i} in

test | mysql | lost+found )

echo “Skipping database: ${i}”

;;

* )

echo “Dumping database: ${i} @ $(date)”

mysqldump -u${DB_ACCOUNT} -p${DB_PASSWORD} –quick ${i} > ${MYSQL_DUMPS}/$(date +%y%m%d).${i}.sql

echo “Compressing dump of ${i} @ $(date)”

gzip ${MYSQL_DUMPS}/$(date +%y%m%d).${i}.sql

;;

esac

done

echo “Completed @ $(date)”


This might help if you are not using a control panel!
__________________
UnixGuru Hosting - Performance Hosting Specialists Serving Customer Websites since 1999!
Geolocalised Hosting, 14 Euro Zones, 1 Reseller Account Geolocalised VPSs
█ Get 25% off Shared & Reseller Hosting with Promo Code: WHC-25-OFF