BACK_DIR=/data/backup/`date + %y%m%d` MYSQLDB=discuz 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 $BAcK_DIR];then mkdir -p $BAcK_DIR echo "\033[32mThe $BACK_DIR Create Successfully!" else echo "This $BACK_DIR is exists." fi $MYSQLCMD -u$MYSQLUSR -p$MYSQLPW discuz >$BACK_DIR/$MYSQLDB.sql