Database Dump Script

From SolusVM

Jump to: navigation, search

This script can be used to take a compressed dump of the masters database. You can then ftp, scp, rsync etc.. the database off the server.

#!/bin/sh
 
## Vars
CONF=/usr/local/solusvm/includes/solusvm.conf
FILENAME=solusvm_database_dump.gz
 
## Get the database details
DN=`grep -m1 $1: ${CONF} | cut -d ':' -f 1`;
DU=`grep -m1 $1: ${CONF} | cut -d ':' -f 2`;
DP=`grep -m1 $1: ${CONF} | cut -d ':' -f 3`;
 
## Do the dump
echo "Dumping database..."
mysqldump --opt -h localhost --user=${DU} --password=${DP} ${DN} | gzip > /usr/local/solusvm/tmp/${FILENAME};
echo "Complete."
Personal tools
Installation/Upgrading
Customization