1
This is a script I use to backup my entire XOOPS installation... Now, depending on how large your installation is, you can do various things here... You can modify it to pack it into smaller files acceptable by your gmail account, and then this script is perfect for all files and SQL DB.
#!/bin/bash -f
# Determine current date
export CURDATE=`date +%Y%m%d`
#Provide the path for your XOOPS directory
TargetDir=/path/to/your/Xoops/files
Server=yourserveraddress
MysqlUname=your_mysql_username
MysqlPass=your_mysql_pass
MysqlDbase=your_mysql_database
SndEmail=your@domain.com
# Backup XOOPS database to compressed, dated file in tmp directory
echo backing up MySQL database to file /tmp/${CURDATE}_db-backup.sql.gz
mysqldump --opt -q -e -h${Server} -u${MysqlUname} -p${MysqlPass} ${MysqlDbase} | gzip > /tmp/${CURDATE}_db-backup.sql.gz
# Backup WP files to compressed, dated file in tmp directory
cd $TargetDir
echo backing up all files to /tmp/${CURDATE}_files.tar.gz
tar cf - . | gzip > /tmp/${CURDATE}_files.tar.gz
# Send emails with the files (GMail anyone?)
cat /tmp/${CURDATE}_db-backup.sql.gz | uuencode ${CURDATE}_db-backup.sql.gz | mail -s ${CURDATE}.BackupDatabase ${SndEmail}
echo Done sending email with MySQL backup ...
cat /tmp/${CURDATE}_files.tar.gz | uuencode ${CURDATE}_files.tar.gz | mail -s ${CURDATE}.BackupFiles ${SndEmail}
echo Done sending email with file backup ...
# delete the backup files from the server after you are done with the email
echo Deleting MySQL backup files
rm --force /tmp/${CURDATE}_db-backup.sql.gz
echo Deleting file backup
rm --force /tmp/${CURDATE}_files.tar.gz