mysql backup script

#!/bin/bash
# change to fit you needs
USER=mysql
PASS=mypass
BACKUPDIR=/nfs/mysql/
BACKUPS LOGFILE=/nfs/mysql/daily-backup.log
#no changes needed below
DATE=`date +%F_%H-%M-%S`
FILENAME=mysqldump.$DATE.sql
echo "##########################################" >> $LOGFILE
echo "Starting DB backup on `hostname` on `date +%F` `date +%T`" >> $LOGFILE
/opt/mysql/bin/mysqldump -u$USER -p$PASS --all-databases 2>> $LOGFILE | gzip > $BACKUPDIR/$FILENAME.gz
if [ ${PIPESTATUS[0]} -eq 0 ] ; then
echo `date +%F_%H-%M-%S` >> $LOGFILE
echo "Backup to $FILENAME was successful" >> $LOGFILE
else
echo `date +%F_%H-%M-%S` >> $LOGFILE
echo "Backup to $FILENAME was NOT successful" >> $LOGFILE
fi