Current File : /home/lifechur/backups/dblist.txt~
#!/bin/bash
echo "Beginning"

# Initialize some variables.
suffix=$(date +%y%m%d)
dbuid="lcmdbmgr"
dbpwd="treeoflife"
recipients="pastor.rocklyn@lifechurchboston.org"


# Switch to the backups directory.
cd /home/lifechur/backups/

# Create a staging area for the MySQL backups.
mkdir mysql

# Dump the databases.
mysqldump --opt -u$dbuid -p$dbpwd -h lcmwikisrv.wiki.lifechurchministries.org lcmwikidb > mysql/lcmwikidbA.$suffix.sql
#mysqldump --opt -ulcmdbmgr -ptreeoflife -h lcmwikisrv.wiki.lifechurchministries.org lcmwikidb > mysql/lcmwikidbA.$suffix.sql

# Create a tar archive of the database dump files.
tar -cf archives/mysql_backup.$suffix.tar mysql/*

# Mail the tar archive to interested parties.
/usr/bin/mutt -a /home/lifechur/backups/archives/mysql_backup.$suffix.tar -s "MySQL Backup" $recipients < /dev/null

# Delete the staging area.
rm -r mysql/