Step 2: insert the contents (Bold means customize)
#!/bin/sh
# List all of the MySQL databases that you want to backup in here,
# each separated by a space
databases="DBNAME"
backupdir=/FULL/PATH
mysqldumpcmd=/usr/bin/mysqldump
userpassword=" --user=USER --password=PASS"
# MySQL dump options
dumpoptions=" --quick --add-drop-table --add-locks --extended-insert
--lock-tables"
# Unix Commands
gzip=/bin/gzip
# Create our backup directory if not already there
mkdir -p ${backupdir}
if [ ! -d ${backupdir} ]
then
echo "Not a directory: ${backupdir}"
exit 1
fi
#get currentdate
today=`date +%w`
# Dump all of our databases
echo "Dumping MySQL Databases"
for database in $databases
do $mysqldumpcmd $userpassword $dumpoptions $database > ${backupdir}/${database}-$today.sql
done
# Compress all of our backup files
echo "Compressing Dump Files"
for database in $databases
do
rm -f ${backupdir}/${database}-$today.sql.gz
$gzip ${backupdir}/${database}-$today.sql
done
echo "Done Compressing"
# And we're done
# This displays the data
ls -l ${backupdir}
# Sets permissions for our next step ;) FTP synchronization use
chown backup *.*
chgrp psacln *.*