[root@bogon ~]# cat auto_backup_mysql.sh
#!/bin/bash
#auto backup mysql db
#by authors wugk 2014
#define backup path
BAK_DIR=/data/backup/`date +%Y%m%d`
MYSQLDB=cacti
MYSQLUSR=backup
MYSQLPW=123456
MYSQLCMD=/usr/bin/mysqldump
if [ $UID -ne 0 ];then
echo "Must to be use root for exec shell."
exit
fi
if [ ! -d $BAK_DIR ];then
mkdir -p $BAK_DIR
echo -e "