export MDATE=`date +%Y%m%d`

export USER="백업계정"

export PASSWD="백업계정비밀번호"

export PORT="포트숫자"

export BACKUPDIR="백업경로"  ##full backup 경로와 다름

export LOGDIR="로그경로"


touch $LOGDIR/FULL_TRANS_$MDATE.log

epxort LOG="$LOGDIR/FULL_TRANS_$MDATE.log"



function FULLTRANS() {

echo "-----"| tee -a $FULLLOG
echo `date +%Y-%m-%d' '%H:%M:%S` >> $LOG
echo "TRANSPORT  START" >> $FULLLOG
echo "----" >> $FULLLOG

/usr/local/bin/sshpass -p $PASSWORD /usr/bin/ssh -T -oStrictHostKeyChecking=no $USER@$HOST <<EOF1
mkdir -p $BACKUPDIR/$MDATE
EOF1
/usr/local/bin/sshpass -p $PASSWORD scp -r /maria_backup/full $USER@$HOST:$BACKUPDIR/$MDATE/
}


FULLTRANS
if [ $? = "0" ]; then
echo `date +%Y-%m-%d' '%H:%M:%S` >> $LOG
echo "FULLBACKUP TRANSPORT COMPLETE" >> $LOG
else
echo `date +%Y-%m-%d' '%H:%M:%S` >> $LOG
echo "FULLBACKUP TRANSPORT FAILED" >> $LOG
fi


'mysql' 카테고리의 다른 글

incre_trans.sh  (0) 2018.02.20
incre.sh  (0) 2018.02.19
backup crontab  (0) 2018.02.19
full backup  (0) 2018.02.19

+ Recent posts