#!/bin/sh
#----------------------------------------------------------------------
wnum=`date +%u`
if [ "$wnum" = "1" ] || [ "$wnum" = "3" ] || [ "$wnum" = "5" ]
then
wnum2='w135'
elif [ "$wnum" = "2" ] || [ "$wnum" = "4" ] || [ "$wnum" = "6" ]
then
wnum2='w246'
elif [ "$wnum" = "7" ]
then
wnum2='w7'
fi
#----------------------------------------------------------------------
DB_NAME="sx3g"
DB_USER="root"
DB_PASS='OL_X7"!*E9k'
BIN_DIR="/usr/bin"
BCK_DIR="/data/mysqlbak"
#----------------------------------------------------------------------
LOGFILE_NAME=/data/mysqlbak/mysqldump.log
#----------------------------------------------------------------------
echo "********** Begin to mysqldump at {`date +%y-%m-%d---%H:%M:%S`} ...." | tee -a $LOGFILE_NAME
#----------------------------------------------------------------------
$BIN_DIR/mysqldump -u$DB_USER -p$DB_PASS $DB_NAME --opt --default-character-set=utf8 --hex-blob --single-transaction --flush-
logs | gzip > $BCK_DIR/sx3g_$wnum2.gz
#----------------------------------------------------------------------
echo "********** End to mysqldump at {`date +%y-%m-%d---%H:%M:%S`} ...." | tee -a $LOGFILE_NAME
#----------------------------------------------------------------------
阅读(357) | 评论(0) | 转发(0) |