소스 검색

2019/08/07 23:50:00

master
Gitea 6 년 전
커밋
3f1aa6f5f9

+ 330
- 0
01.ENV_check.sh 파일 보기

@@ -0,0 +1,330 @@
#!/bin/bash
Script_SRC_BAK=ED8backup-mysql-Auto.sh.SRC
Script_TMP_BAK=ED8backup-mysql-Auto.sh.TMP
Script_REAL_BAK=ED8backup-mysql-Auto.sh
Script_SRC_Restore=ED8restore_from_local-mysql.sh.SRC
Script_TMP_Restore=ED8restore_from_local-mysql.sh.TMP
Script_REAL_Restore=ED8restore_from_local-mysql.sh

USER=`whoami`
PWFile="/home/$USER/PW/mysql_ED8.info"
WORK_Folder="/ED/ED8/Script_ED8"
SOUCE_Folder="/ED/ED8/Source_Files"
Bak_Folder="/ED/ED8/Backup_file"

UTY_1=expect
UTY_2=lsscsi
UTY_3=gunzip
UTY_4=mysql
UTY_5=mysqldump

CHK_QTY=9

cp $Script_SRC_BAK $Script_TMP_BAK
cp $Script_SRC_Restore $Script_TMP_Restore

echo -e -n "You are \033[44;37m$USER\033[0m. Is it correct? (y|n) "
read yn
if [[ $yn == y ]]; then
echo -e "Change necessary files owner to $USER"
sudo chown $USER:$USER /ED/ED8 -R
elif [[ $yn == n ]]; then
echo "\033[31mYour input is $yn. Exit. "
echo
exit
else
echo -e "\033[41;37mWrong input ($yn). Exit. \033[0m"
echo
exit
fi

echo
echo -e "\033[32mCheck list: \033[0m"
echo -e " \033[33m01. Password file \t\t= $PWFile\033[0m"
echo -e " \033[33m02. Work Folder \t\t= $WORK_Folder\033[0m"
echo -e " \033[33m03. Source files folder \t= $SOUCE_Folder\033[0m"
echo -e " \033[33m04. Local Backup Folder \t= $Bak_Folder\033[0m"
echo -e " \033[33m05. Utility status \t\t= $UTY_1\033[0m"
echo -e " \033[33m06. Utility status \t\t= $UTY_2\033[0m"
echo -e " \033[33m07. Utility status \t\t= $UTY_3\033[0m"
echo -e " \033[33m08. Utility status \t\t= $UTY_4\033[0m"
echo -e " \033[33m09. Utility status \t\t= $UTY_5\033[0m"
echo
echo

i=0

##### Func
SEL_BAK_Mode (){
echo -e "\033[33mPlease select which backup mode do you want to use? \033[0m"
echo -e " \033[32mA: OS_HDD only \t\t\t(You only have one Storage in host) \033[0m"
echo -e " \033[32mB: OS_HDD + BAK_Disk_A\t\t(You have two Storages installed in host at least) \033[0m"
echo -e " \033[32mC: OS_HDD + BAK_Disk_A + BAK_Disk_B\t(You have three Storages installed in host at least) \033[0m"
echo
echo -e -n "\033[33mPlease input: (A|B|C) \033[0m"
read MODE
if [[ $MODE == "A" ]]; then
echo -e " Your input is (A): OS_HDD only"
elif [[ $MODE == "B" ]]; then
echo -e " Your input is (B): OS_HDD + BAK_Disk_A - You have two Storages installed in host at least"
QTY_Storage=`lsscsi | awk '{print $2}' | grep "disk" |wc -l`
if [[ $QTY_Storage < 2 ]]; then
echo -e " \033[41;37m>> You don't have enough Storages ($QTY_Storage) to do this. Exit \033[0m"
echo
lsscsi
echo
exit
fi

lsscsi
echo
echo -e -n "\033[33mAbove are all installed storages, which one is your BAK_Disk_A? (sda|sdb|sdc|sdx) \033[0m"
read STORAGE_A
lsscsi | grep $STORAGE_A > /dev/null 2>&1
if [[ $? != 0 ]]; then
echo -e " \033[41;37mThere is no storage named /dev/$STORAGE_A in list. Exit \033[0m"
echo
exit
fi

sed -i "s/BAK_Disk_A=\/dev\/sdb/BAK_Disk_A=\/dev\/$STORAGE_A/g" $Script_TMP_BAK
sed -i 's/#CHK_BAK_Disk_A/CHK_BAK_Disk_A/g' $Script_TMP
sed -i 's/#CHK_BAK_Disk_A_Mount_Point/CHK_BAK_Disk_A_Mount_Point/g' $Script_TMP_BAK
sed -i 's/#CHK_BAK_Disk_A_Mount_Status/CHK_BAK_Disk_A_Mount_Status/g' $Script_TMP_BAK
sed -i 's/#CHK_BAK_Disk_A_Hostname_Folder/CHK_BAK_Disk_A_Hostname_Folder/g' $Script_TMP_BAK
sed -i 's/#CHK_BAK_Disk_A_ED8_BAK_Folder/CHK_BAK_Disk_A_ED8_BAK_Folder/g' $Script_TMP_BAK
sed -i 's/#CP_TO_BAK_Disk_A/CP_TO_BAK_Disk_A/g' $Script_TMP_BAK
echo -e " >> Set it done. "
echo
elif [[ $MODE == "C" ]]; then
echo -e " Your input is (C): OS_HDD + BAK_Disk_A + BAK_Disk_B - You have three Storages installed in host at least"
QTY_Storage=`lsscsi | awk '{print $2}' | grep "disk" | wc -l`
if [[ $QTY_Storage < 3 ]]; then
echo -e " \033[41;37m>> You don't have enough Storages ($QTY_Storage) to do this. Exit \033[0m"
echo
lsscsi
echo
exit
fi

lsscsi
echo
echo -e -n "\033[33mAbove are all installed storages, which one is your BAK_Disk_A? (sda|sdb|sdc|sdx) \033[0m"
read STORAGE_A
lsscsi | grep $STORAGE_A > /dev/null 2>&1
if [[ $? != 0 ]]; then
echo -e " \033[41;37mThere is no storage named /dev/$STORAGE_A in list. Exit \033[0m"
echo
exit
fi

sed -i "s/BAK_Disk_A=\/dev\/sdb/BAK_Disk_A=\/dev\/$STORAGE_A/g" $Script_TMP_BAK
sed -i 's/#CHK_BAK_Disk_A/CHK_BAK_Disk_A/g' $Script_TMP_BAK
sed -i 's/#CHK_BAK_Disk_A_Mount_Point/CHK_BAK_Disk_A_Mount_Point/g' $Script_TMP_BAK
sed -i 's/#CHK_BAK_Disk_A_Mount_Status/CHK_BAK_Disk_A_Mount_Status/g' $Script_TMP_BAK
sed -i 's/#CHK_BAK_Disk_A_Hostname_Folder/CHK_BAK_Disk_A_Hostname_Folder/g' $Script_TMP_BAK
sed -i 's/#CHK_BAK_Disk_A_ED8_BAK_Folder/CHK_BAK_Disk_A_ED8_BAK_Folder/g' $Script_TMP_BAK
sed -i 's/#CP_TO_BAK_Disk_A/CP_TO_BAK_Disk_A/g' $Script_TMP_BAK
echo -e " >> Set it done. "
echo

echo -e -n "\033[33mWhich one is your BAK_Disk_B? (sda|sdb|sdc|sdx) \033[0m"
read STORAGE_B
if [[ $STORAGE_A == $STORAGE_B ]]; then
echo -e "\033[41;37mYour BAK_Disk_A($STORAGE_A) and BAK_Disk_A($STORAGE_A) are the same. Wrong inout. Exit \033[0m"
echo
exit
fi

lsscsi | grep $STORAGE_B > /dev/null 2>&1
if [[ $? != 0 ]]; then
echo -e " \033[41;37mThere is no storage named /dev/$STORAGE_B in list. Exit \033[0m"
echo
exit
fi

sed -i "s/BAK_Disk_B=\/dev\/sda/BAK_Disk_B=\/dev\/$STORAGE_B/g" $Script_TMP_BAK
sed -i 's/#CHK_BAK_Disk_B/CHK_BAK_Disk_B/g' $Script_TMP_BAK
sed -i 's/#CHK_BAK_Disk_B_Mount_Point/CHK_BAK_Disk_B_Mount_Point/g' $Script_TMP_BAK
sed -i 's/#CHK_BAK_Disk_B_Mount_Status/CHK_BAK_Disk_B_Mount_Status/g' $Script_TMP_BAK
sed -i 's/#CHK_BAK_Disk_B_Hostname_Folder/CHK_BAK_Disk_B_Hostname_Folder/g' $Script_TMP_BAK
sed -i 's/#CHK_BAK_Disk_B_ED8_BAK_Folder/CHK_BAK_Disk_B_ED8_BAK_Folder/g' $Script_TMP_BAK
sed -i 's/#CP_TO_BAK_Disk_B/CP_TO_BAK_Disk_B/g' $Script_TMP_BAK
echo -e " >> Set it done. "
echo
else
echo -e " \033[41;37mWrong input ($MODE). Exit \033[0m"
echo
exit
fi
}

CHK_PWFile (){
ls $PWFile > /dev/null 2>&1
if [[ $? != 0 ]]; then
echo -e " \033[31m01. Fail. $PWFile doesn't exist. Please create one. Exit \033[0m"
echo
echo -e "$PWFile Content example: "
echo -e "Database_Name: db_ed8_"
echo -e "ID: root"
echo -e "Password: +039*******"
echo
exit
else
echo -e " \033[34m01. Pass. $PWFile exist. \033[0m"

DATABASEName="`cat $PWFile | grep Database_Name: | awk '{print $NF}'`"
DATABASEUser="`cat $PWFile | grep ID: | awk '{print $NF}'`"
DATABASEPassword="`cat $PWFile | grep Password: | awk '{print $NF}'`"

echo -e -n " >> 01-1. Check context information accuracy (DATABASEName)\t\t: "
if [[ $DATABASEName == "" ]]; then
echo -e "\033[31mFail. There is no correct info of DATABASEName in $PWFile. Exit\033[0m"
echo
exit
else
echo -e "\033[34mGood \033[0m"
fi

echo -e -n " >> 01-2. Check context information accuracy (DATABASEUser)\t\t: "
if [[ $DATABASEUser == "" ]]; then
echo -e "\033[31mFail. There is no correct info of DATABASEUser in $PWFile. Exit\033[0m"
echo
exit
else
echo -e "\033[34mGood \033[0m"
fi

echo -e -n " >> 01-3. Check context information accuracy (DATABASEPassword)\t: "
if [[ $DATABASEPassword == "" ]]; then
echo -e "\033[31mFail. There is no correct info of DATABASEPassword in $PWFile. Exit\033[0m"
echo
exit
else
echo -e "\033[34mGood \033[0m"
fi
i=$((i+1))
fi
}

CHK_Work_F (){
if [[ `pwd` != $WORK_Folder ]]; then
echo -e " \033[31m02. Fail. It's not work folder \"$WORK_Folder\". \033[0m"
else
echo -e " \033[34m02. Pass. Current Work Folder is $WORK_Folder \033[0m"
i=$((i+1))
fi
}

CHK_SRC_F (){
ls $SOUCE_Folder > /dev/null 2>&1
if [[ $? != 0 ]]; then
echo -e " \033[31m03. Fail. $SOUCE_Folder doesn't exist. \033[0m"
else
echo -e " \033[34m03. Pass. $SOUCE_Folder folder exist. \033[0m"
i=$((i+1))
fi
}

CHK_BAK_F (){
ls $Bak_Folder > /dev/null 2>&1
if [[ $? != 0 ]]; then
echo -e " \033[31m04. Fail. $Bak_Folder doesn't exist. Create a new one. \033[0m"
sudo mkdir -p $Bak_Folder
chown $USER:$USER $Bak_Folder -R
else
echo -e " \033[34m04. Pass. $Bak_Folder folder exist. \033[0m"
i=$((i+1))
fi
}

CHK_UTY_1 (){
man $UTY_1 > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " \033[34m05. Pass. The utility ($UTY_1) was installed. \033[0m"
i=$((i+1))
else
echo -e " \033[31m05. Fail. The utility ($UTY_1) not be installed. \033[0m"
fi
}

CHK_UTY_2 (){
man $UTY_2 > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " \033[34m06. Pass. The utility ($UTY_2) was installed. \033[0m"
i=$((i+1))
else
echo -e " \033[31m06. Fail. The utility ($UTY_2) not be installed. \033[0m"
fi
}

CHK_UTY_3 (){
man $UTY_3 > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " \033[34m07. Pass. The utility ($UTY_3) was installed. \033[0m"
i=$((i+1))
else
echo -e " \033[31mm07. Fail. The utility ($UTY_3) not be installed. \033[0m"
fi
}
CHK_UTY_4 (){
man $UTY_4 > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " \033[34m08. Pass. The utility ($UTY_4) was installed. Setting ED8restore_from_local-mysql.sh use it. \033[0m"
sed -i 's/\/opt\/lampp\/bin\/mysql -u/mysql -u/g' $Script_TMP_Restore
i=$((i+1))
else
echo -e " \033[33m08. Warning! The utility ($UTY_4) not be installed by apt, but service might be provided by xampp. \033[0m"
ls /opt/lampp/bin/mysql > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " \033[35m>> Good. your mysql service is provided by xampp \033[0m"
i=$((i+1))
else
echo -e " \033[31m>> Fail. mysql service not be provided by xampp either. \033[0m"
fi
fi
}
CHK_UTY_5 (){
man $UTY_5 > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " \033[34m09. Pass. The utility ($UTY_5) was installed. Setting ED8backup-mysql-Auto.sh use it. \033[0m"
sed -i 's/\/opt\/lampp\/bin\/mysqldump -u/mysqldump -u/g' $Script_TMP_BAK
i=$((i+1))
else
echo -e " \033[33m09. Fail. The utility ($UTY_5) not be installed by apt. \033[0m"
ls /opt/lampp/bin/mysqldump > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " \033[35m>> Good. your mysqldump is provided by xampp. \033[0m"
i=$((i+1))
else
echo -e " \033[31m>> Fail. mysql service not be provided by xampp either. \033[0m"
fi
fi
}

SEL_BAK_Mode
echo
echo
echo -e "\033[32mStart check list check... \033[0m"
CHK_PWFile
CHK_Work_F
CHK_SRC_F
CHK_BAK_F
CHK_UTY_1
CHK_UTY_2
CHK_UTY_3
CHK_UTY_4
CHK_UTY_5

cp $Script_TMP_BAK $Script_REAL_BAK
cp $Script_TMP_Restore $Script_REAL_Restore

echo
echo
if [[ $i == $CHK_QTY ]]; then
echo -e "\033[33mAll check list Passed. You can start your scripts. \033[0m"
else
echo -e "\033[41;37mFailed. There still be error items. Please check it. \033[0m"
fi
echo


+ 27
- 0
02.AutoBackup_crontab_check.sh 파일 보기

@@ -0,0 +1,27 @@
#!/bin/bash
Service1=/ED/ED8/Script_ED8/ED8backup-mysql-Auto.sh

WHO=`whoami`

crontab -u $WHO -l
echo
crontab -u $WHO -l | grep "$Service1" > /dev/null 2>&1
if [[ $? == 0 ]]; then
crontab -u $WHO -l | grep "$Service1" | cut -c 1-8 | grep "#"
if [[ $? != 0 ]]; then
echo -e "\033[33mPass. $Service1 is running. \033[0m"
else
echo -e "\033[41;37mFail. $Service1 was appended, but not be set as executing. \033[0m"
echo -e "Please add below info by command \033[32m\"crontab -u $WHO -e\"\033[0m"
echo -e "\033[33m28 1 */2 * * $Service1\033[0m"

fi
else
echo -e "\033[41;37mFail. $Service1 was not be set as executing. \033[0m"
echo -e "Please add below info by command \033[32m\"crontab -u $WHO -e\"\033[0m"
echo -e "\033[33m28 1 */2 * * $Service1\033[0m"
fi

echo



+ 65
- 0
ED8backup-Script_ED8-Auto.sh 파일 보기

@@ -0,0 +1,65 @@
#!/bin/bash
LOG_Folder="_LOG"
LOG1=/ED/ED8/Script_ED8/_LOG/ED8backup-Script_ED8.log
TS=`date +"%Y%m%d-%H%M%S"`
Bak_Folder="/ED/ED8/Backup_file"
Bak_File_Name=$Bak_Folder/Script_ED8.tar
Bak_File_Name_TS=$Bak_Folder/Script_ED8-$TS.tar

BAK_Disk_A_Mount_Point="/BAK_Disk_A"
BAK_Disk_A_Hostname_Folder="$BAK_Disk_A_Mount_Point/`hostnamectl | grep "Static hostname" | awk '{print $NF}'`"
BAK_Disk_A_ED8_Script_BAK_Folder="$BAK_Disk_A_Hostname_Folder/ED8/Backup_file"
BAK_Disk_A_ED8_Script_Bak_File_Name_TS="$BAK_Disk_A_ED8_Script_BAK_Folder/Script_ED8-$TS.gz"


Script_Folder=/ED/ED8/Script_ED8
CHK_LOG_Folder (){
ls /ED/ED8/Script_ED8/_LOG > /dev/null 2>&1
if [[ $? != 0 ]]; then
mkdir -p /ED/ED8/Script_ED8/_LOG
fi
}

CHK_Bak_Folder (){
ls $Bak_Folder > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e "\033[33mPass. Backup file saving folder: $Bak_Folder exist, go next.\033[0m"
else
echo -e "\033[31mThere is no Backup file saving folder: $Bak_Folder, next will create a new one automatically.\033[0m"
mkdir -p $Bak_Folder
fi
}

TAR_File (){
tar cvf $Bak_File_Name $Script_Folder
if [[ $? == 0 ]]; then
echo -e "\033[44;37mPass. tar Script_ED8 file OK.\033[0m"
cp $Bak_File_Name $Bak_File_Name_TS
if [[ $? == 0 ]]; then
echo -e "\033[44;37mPass. Make a copy file to \"$Bak_Folder\". Finished!\033[0m"
else
echo -e "\033[41;37mFail. Make a copy file to \"$Bak_Folder\" failed.\033[0m"
fi
else
echo -e "\033[41;37mFail. tar Script_ED8 file failed.\033[0m"
fi
}

CP_To_BAK_Disk_A (){
cp $Bak_File_Name $BAK_Disk_A_ED8_Script_Bak_File_Name_TS
if [[ $? == 0 ]]; then
echo -e "\033[34mPass. Copied to BAK_Disk_A. \033[0m"
else
echo -e "\033[31mFail. Copied to BAK_Disk_A. \033[0m"
fi
}

echo -e "===== `date +"%Y/%m/%d %H:%M:%S"` ===== \033[45;37m$0\033[0m =====" | tee -a $LOG1
CHK_LOG_Folder | tee -a $LOG1
CHK_Bak_Folder | tee -a $LOG1
TAR_File | tee -a $LOG1
CP_To_BAK_Disk_A | tee -a $LOG1

echo
echo -e "LOG file:"
echo -e " $LOG1"

+ 347
- 0
ED8backup-mysql-Auto.sh 파일 보기

@@ -0,0 +1,347 @@
#!/bin/bash
USER=`whoami`
PWFile="/home/$USER/PW/mysql_ED8.info"
DATABASEName="`cat $PWFile | grep Database_Name: | awk '{print $NF}'`"
DATABASEUser="`cat $PWFile | grep ID: | awk '{print $NF}'`"
DATABASEPassword="`cat $PWFile | grep Password: | awk '{print $NF}'`"
TS=`date +"%Y%m%d-%H%M%S"`
LOG_Folder="/ED/ED8/Script_ED8/_LOG"
LOG1=/ED/ED8/Script_ED8/_LOG/ED8backup-mysql-Auto.log

ED8_Bak_Folder="/ED/ED8/Backup_file"
ED8_Bak_File_Name=$ED8_Bak_Folder/backup-mysql-ED8.gz
ED8_Bak_File_Name_TS=$ED8_Bak_Folder/backup-mysql-ED8-$TS.gz

BAK_Disk_A=/dev/sdb
BAK_Disk_A_Mount_Point="/BAK_Disk_A"
BAK_Disk_A_Hostname_Folder="$BAK_Disk_A_Mount_Point/`hostnamectl | grep "Static hostname" | awk '{print $NF}'`"

BAK_Disk_A_ED8_BAK_Folder="$BAK_Disk_A_Hostname_Folder/ED8/Backup_file"
BAK_Disk_A_ED8_Bak_File_Name_TS="$BAK_Disk_A_ED8_BAK_Folder/backup-mysql-ED8-$TS.gz"

BAK_Disk_B=/dev/sda
BAK_Disk_B_Mount_Point="/BAK_Disk_B"
BAK_Disk_B_Hostname_Folder="$BAK_Disk_B_Mount_Point/`hostnamectl | grep "Static hostname" | awk '{print $NF}'`"

BAK_Disk_B_ED8_BAK_Folder="$BAK_Disk_B_Hostname_Folder/ED8/Backup_file"
BAK_Disk_B_ED8_Bak_File_Name_TS="$BAK_Disk_B_ED8_BAK_Folder/backup-mysql-ED8-$TS.gz"


##### FUNC
CHK_PWFile (){
echo -e "\033[32mCheck the mysql password info file exist: \033[0m"
ls $PWFile > /dev/null 2>&1
if [[ $? != 0 ]]; then
echo -e " >> \033[31mFail. $PWFile didn't exist. Please create one. Exit\033[0m" | tee -a $LOG1
echo
echo -e "$PWFile Content example: "
echo -e "Database_Name: db_ed8_"
echo -e "ID: root"
echo -e "Password: +039*******"
echo
exit
else
echo -e " >> \033[34mPass. $PWFile exist.\033[0m" | tee -a $LOG1
echo -e -n " Check context information accuracy (DATABASEName)\t\t: "
if [[ $DATABASEName == "" ]]; then
echo -e "\033[31mFail. There is no correct info of DATABASEName in $PWFile. Exit\033[0m"
echo
exit
else
echo -e "\033[34mPass. \033[0m"
fi

echo -e -n " Check context information accuracy (DATABASEUser)\t\t: "
if [[ $DATABASEUser == "" ]]; then
echo -e "\033[31mFail. There is no correct info of DATABASEUser in $PWFile. Exit\033[0m"
echo
exit
else
echo -e "\033[34mPass. \033[0m"
fi

echo -e -n " Check context information accuracy (DATABASEPassword)\t: "
if [[ $DATABASEPassword == "" ]]; then
echo -e "\033[31mFail. There is no correct info of DATABASEPassword in $PWFile. Exit\033[0m"
echo
exit
else
echo -e "\033[34mPass. \033[0m"
fi
fi
}

CHK_LOG_Folder (){
echo -e "\033[32mCheck the auto backup log saving folder exist: \033[35m($LOG_Folder) \033[0m"
ls $LOG_Folder > /dev/null 2>&1
if [[ $? != 0 ]]; then
echo -e " >> \033[33mWarning! There is no folder \"$LOG_Folder\". Next will create a new one.\033[0m" | tee -a $LOG1
sudo mkdir -p $LOG_Folder
chown $USER:$USER $LOG_Folder -R
if [[ $? != 0 ]]; then
echo -e " >> \033[41;37mCreate the folder failed. Exit\033[0m"
echo
exit
fi
else
echo -e " >> \033[34mPass. There is a folder \"$LOG_Folder\". \033[0m" | tee -a $LOG1
fi
}

CHK_ED8_Bak_Folder (){
echo -e "\033[32mCheck the local original backup folder exist: \033[35m($ED8_Bak_Folder) \033[0m"
ls $ED8_Bak_Folder > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " >> \033[34mPass. Backup file saving folder: $ED8_Bak_Folder exist, go next.\033[0m" | tee -a $LOG1
else
echo -e " >> \033[33mWarning! There is no Backup file saving folder: $ED8_Bak_Folder, next will create a new one automatically.\033[0m" | tee -a $LOG1
sudo mkdir -p $ED8_Bak_Folder
chown $USER:$USER $ED8_Bak_Folder -R
if [[ $? != 0 ]]; then
echo -e " >> \033[41;37mCreate the folder failed. Exit\033[0m"
echo
exit
fi
fi
}

Mysql_Dump (){
echo -e "\033[32mStarting mysqldump...\033[0m"
echo -e "\033[45;37m==========================================================================================\033[0m" | tee -a $LOG1
echo -e "\033[41;37m Important! Please check below messages for making sure mysqldump be performed exactly. \033[0m" | tee -a $LOG1
mysqldump -u $DATABASEUser -p$DATABASEPassword $DATABASEName | gzip > $ED8_Bak_File_Name
# mysqldump -u $DATABASEUser -p$DATABASEPassword $DATABASEName | gzip > $ED8_Bak_File_Name
if [[ $? == 0 ]]; then
echo -e " >> \033[34mPass. mysql dump w/ gzip OK. \033[0m" | tee -a $LOG1
else
echo -e " >> \033[41;37m Fail. mysql dump w/ gzip failed. Exit \033[0m" | tee -a $LOG1
echo -e " >> \033[31m If you got error message, please try to perform below command for debugging\033[0m" | tee -a $LOG1
echo -e " >> \033[31m # sudo mysqldump -u ed -p db_ed8_ | gzip > $ED8_Bak_File_Name \033[0m" | tee -a $LOG1
echo
exit
fi
echo -e "\033[45;37m==========================================================================================\033[0m" | tee -a $LOG1
echo -e " Debug message: "
echo -e " \033[31m* mysqldump: Got error: 1045: Access denied for user 'root'@'localhost' (using password: YES) when trying to connect \033[0m "
echo -e " >> Please check the content of $PWFile"
echo -e "\033[45;37m==========================================================================================\033[0m"

echo -e "\033[32mStarting make a copy with timastamp filename...\033[0m" | tee -a $LOG1
cp $ED8_Bak_File_Name $ED8_Bak_File_Name_TS
if [[ $? == 0 ]]; then
echo -e " >> \033[34mPass. Make a copy OK - \033[35m($ED8_Bak_File_Name_TS) \033[0m" | tee -a $LOG1
else
echo -e " >> \033[41;37mFail. Make a copy failed. Exit\033[0m - \033[35m($ED8_Bak_File_Name_TS) \033[0m" | tee -a $LOG1
echo
exit
fi
}

CHK_BAK_Disk_A (){
echo -e "\033[32mCheck the detection of Backup_Disk_A: \033[35m(lsscsi $BAK_Disk_A) \033[0m"
lsscsi | grep $BAK_Disk_A > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " >> \033[34mPass. The BAK_Disk_A \"$BAK_Disk_A\" be detected by lsscsi. \033[0m" | tee -a $LOG1
else
echo -e " >> \033[41;37mFail. The BAK_Disk_A \"$BAK_Disk_A\" not be detected by lsscsi. Exit \033[0m" | tee -a $LOG1
echo
exit
fi
}

CHK_BAK_Disk_B (){
echo -e "\033[32mCheck the detection of Backup_Disk_A: \033[35m(lsscsi $BAK_Disk_B) \033[0m"
lsscsi | grep $BAK_Disk_B > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " >> \033[34mPass. The BAK_Disk_B \"$BAK_Disk_B\" be detected by lsscsi. \033[0m" | tee -a $LOG1
else
echo -e " >> \033[41;37mFail. The BAK_Disk_B \"$BAK_Disk_B\" not be detected by lsscsi. Exit \033[0m" | tee -a $LOG1
echo
exit
fi
}

CHK_BAK_Disk_A_Mount_Point (){
echo -e "\033[32mCheck the BAK_Disk_A mount point folder exist: \033[35m($BAK_Disk_A_Mount_Point) \033[0m"
ls $BAK_Disk_A_Mount_Point > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " >> \033[34mPass. The BAK_Disk_A mount point exist \"$BAK_Disk_A_Mount_Point\"\033[0m" | tee -a $LOG1
else
echo -e " >> \033[33mWarning! The BAK_Disk_A mount point doesn't exist \"$BAK_Disk_A_Mount_Point\"\033[0m, auto create a new one. " | tee -a $LOG1
sudo mkdir -p $BAK_Disk_A_Mount_Point
chown $USER:$USER $BAK_Disk_A_Mount_Point -R
if [[ $? != 0 ]]; then
echo -e " >> \033[41;37mCreate the folder failed. Exit\033[0m"
echo
exit
fi

fi
}

CHK_BAK_Disk_B_Mount_Point (){
echo -e "\033[32mCheck the BAK_Disk_A mount point folder exist: \033[35m($BAK_Disk_B_Mount_Point) \033[0m"
ls $BAK_Disk_B_Mount_Point > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " >> \033[34mPass. The BAK_Disk_B mount point exist \"$BAK_Disk_B_Mount_Point\"\033[0m" | tee -a $LOG1
else
echo -e " >> \033[33mWarning! The BAK_Disk_B mount point doesn't exist \"$BAK_Disk_B_Mount_Point\"\033[0m, auto create a new one. " | tee -a $LOG1
sudo mkdir -p $BAK_Disk_B_Mount_Point
chown $USER:$USER $BAK_Disk_B_Mount_Point -R
if [[ $? != 0 ]]; then
echo -e " >> \033[41;37mCreate the folder failed. Exit\033[0m"
echo
exit
fi

fi
}

CHK_BAK_Disk_A_Mount_Status (){
echo -e "\033[32mCheck the BAK_Disk_A mount status: \033[0m"
if [[ `df -h | grep $BAK_Disk_A | awk '{print $NF}'` != $BAK_Disk_A_Mount_Point ]]; then
echo -e " >> \033[31mFail. The BAK_Disk_A ($BAK_Disk_A) not be mounted at \"$BAK_Disk_A_Mount_Point\". Exit. \033[0m" | tee -a $LOG1
df -h
echo
exit
else
echo -e " >> \033[34mPass. The BAK_Disk_A ($BAK_Disk_A) be mounted at \"$BAK_Disk_A_Mount_Point\"\033[0m" | tee -a $LOG1
fi
}

CHK_BAK_Disk_B_Mount_Status (){
echo -e "\033[32mCheck the BAK_Disk_B mount status: \033[0m"
if [[ `df -h | grep $BAK_Disk_B | awk '{print $NF}'` != $BAK_Disk_B_Mount_Point ]]; then
echo -e " >> \033[31mFail. The BAK_Disk_B ($BAK_Disk_B) not be mounted at \"$BAK_Disk_B_Mount_Point\". Exit. \033[0m" | tee -a $LOG1
df -h
echo
exit
else
echo -e " >> \033[34mPass. The BAK_Disk_B ($BAK_Disk_B) be mounted at \"$BAK_Disk_B_Mount_Point\"\033[0m" | tee -a $LOG1
fi
}

CHK_BAK_Disk_A_Hostname_Folder (){
echo -e "\033[32mCheck the BAK_Disk_A Hostname folder status: \033[35m($BAK_Disk_A_Hostname_Folder) \033[0m"
ls $BAK_Disk_A_Hostname_Folder > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " >> \033[34mPass. BAK_Disk_A Hostname folder: $BAK_Disk_A_Hostname_Folder exist, go next.\033[0m" | tee -a $LOG1
else
echo -e " >> \033[33mWarning! BAK_Disk_A Hostname folder: $BAK_Disk_A_Hostname_Folder, next will create a new one automatically.\033[0m" | tee -a $LOG1
sduo mkdir -p $BAK_Disk_A_Hostname_Folder
chown $USER:$USER $BAK_Disk_A_Hostname_Folder -R
if [[ $? != 0 ]]; then
echo -e " >> \033[41;37mCreate the folder failed. Exit\033[0m"
echo
exit
fi
fi
}

CHK_BAK_Disk_B_Hostname_Folder (){
echo -e "\033[32mCheck the BAK_Disk_B Hostname folder status: \033[35m($BAK_Disk_B_Hostname_Folder) \033[0m"
ls $BAK_Disk_B_Hostname_Folder > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " >> \033[34mPass. BAK_Disk_B Hostname folder: $BAK_Disk_B_Hostname_Folder exist, go next.\033[0m" | tee -a $LOG1
else
echo -e " >> \033[31mWarning! BAK_Disk_B Hostname folder: $BAK_Disk_B_Hostname_Folder, next will create a new one automatically.\033[0m" | tee -a $LOG1
sudo mkdir -p $BAK_Disk_B_Hostname_Folder
chown $USER:$USER $BAK_Disk_B_Hostname_Folder -R
if [[ $? != 0 ]]; then
echo -e " >> \033[41;37mCreate the folder failed. Exit\033[0m"
echo
exit
fi
fi
}

CHK_BAK_Disk_A_ED8_BAK_Folder (){
echo -e "\033[32mCheck the BAK_Disk_A ED8 backup folder status: \033[35m($BAK_Disk_A_ED8_BAK_Folder) \033[0m"
ls $BAK_Disk_A_ED8_BAK_Folder > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " >> \033[34mPass. BAK_Disk's Backup file saving folder: $BAK_Disk_A_ED8_BAK_Folder exist, go next.\033[0m" | tee -a $LOG1
else
echo -e " >> \033[33mWarning! There is no BAK_Disk's Backup file saving folder: $BAK_Disk_A_ED8_BAK_Folder, next will create a new one automatically.\033[0m" | tee -a $LOG1
sudo mkdir -p $BAK_Disk_A_ED8_BAK_Folder
chown $USER:$USER $BAK_Disk_A_ED8_BAK_Folder -R
if [[ $? != 0 ]]; then
echo -e " >> \033[41;37mCreate the folder failed. Exit\033[0m"
echo
exit
fi
fi
}

CHK_BAK_Disk_B_ED8_BAK_Folder (){
echo -e "\033[32mCheck the BAK_Disk_B ED8 backup folder status: \033[35m($BAK_Disk_B_ED8_BAK_Folder) \033[0m"
ls $BAK_Disk_B_ED8_BAK_Folder > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " >> \033[34mPass. BAK_Disk's Backup file saving folder: $BAK_Disk_B_ED8_BAK_Folder exist, go next.\033[0m" | tee -a $LOG1
else
echo -e " >> \033[33mWarning! There is no BAK_Disk's Backup file saving folder: $BAK_Disk_B_ED8_BAK_Folder, next will create a new one automatically.\033[0m" | tee -a $LOG1
sudo mkdir -p $BAK_Disk_B_ED8_BAK_Folder
chown $USER:$USER $BAK_Disk_B_ED8_BAK_Folder -R

if [[ $? != 0 ]]; then
echo -e " >> \033[41;37mCreate the folder failed. Exit\033[0m"
echo
exit
fi
fi
}

CP_TO_BAK_Disk_A (){
echo -e "\033[32mCopy the backup files to Backup_Disk_A...\033[0m"
cp $ED8_Bak_File_Name_TS $BAK_Disk_A_ED8_Bak_File_Name_TS
if [[ $? == 0 ]]; then
echo -e " >> \033[34mPass. Make a copy OK - \033[35m($BAK_Disk_A_ED8_Bak_File_Name_TS) \033[0m" | tee -a $LOG1
else
echo -e " >> \033[41;37mFail. Make a copy failed. Exit\033[0m - \033[35m($BAK_Disk_A_ED8_Bak_File_Name_TS) \033[0m" | tee -a $LOG1
echo
echo -e " \033[35mIf you got (Permission denied) message, please perform below command and re-do again. \033[0m"
echo -e " \033[35mIt happened at fist backup, caused from created disk mount point folder ($BAK_Disk_A_Mount_Point) with sudo \033[0m"
echo -e " \033[41;37m# chown $USER:$USER $BAK_Disk_A_Mount_Point \033[0m"
echo
exit
fi
}

CP_TO_BAK_Disk_B (){
echo -e "\033[32mCopy the backup files to Backup_Disk_B...\033[0m"
cp $ED8_Bak_File_Name_TS $BAK_Disk_B_ED8_Bak_File_Name_TS
if [[ $? == 0 ]]; then
echo -e " >> \033[34mPass. Make a copy OK - \033[35m($BAK_Disk_B_ED8_Bak_File_Name_TS) \033[0m" | tee -a $LOG1
else
echo -e " >> \033[41;37mFail. Make a copy failed. Exit\033[0m - \033[35m($BAK_Disk_B_ED8_Bak_File_Name_TS) \033[0m" | tee -a $LOG1
echo
echo -e " \033[35mIf you got (Permission denied) message, please perform below command and re-do again. \033[0m"
echo -e " \033[35mIt happened at fist backup, caused from created disk mount point folder ($BAK_Disk_B_Mount_Point) with sudo \033[0m"
echo -e " \033[41;37m# chown $USER:$USER $BAK_Disk_B_Mount_Point \033[0m"
echo
exit
fi
}

echo -e "===== `date +"%Y/%m/%d %H:%M:%S"` ===== \033[45;37m$0\033[0m =====" | tee -a $LOG1
CHK_PWFile
CHK_LOG_Folder
CHK_ED8_Bak_Folder
Mysql_Dump
CHK_BAK_Disk_A
CHK_BAK_Disk_A_Mount_Point
CHK_BAK_Disk_A_Mount_Status
CHK_BAK_Disk_A_Hostname_Folder
CHK_BAK_Disk_A_ED8_BAK_Folder
CP_TO_BAK_Disk_A
CHK_BAK_Disk_B
CHK_BAK_Disk_B_Mount_Point
CHK_BAK_Disk_B_Mount_Status
CHK_BAK_Disk_B_Hostname_Folder
CHK_BAK_Disk_B_ED8_BAK_Folder
CP_TO_BAK_Disk_B


echo
echo -e "\033[33mIf you want to check the LOG, please perform below command: "
echo -e " # cat $LOG1\033[0m"
echo

+ 347
- 0
ED8backup-mysql-Auto.sh.SRC 파일 보기

@@ -0,0 +1,347 @@
#!/bin/bash
USER=`whoami`
PWFile="/home/$USER/PW/mysql_ED8.info"
DATABASEName="`cat $PWFile | grep Database_Name: | awk '{print $NF}'`"
DATABASEUser="`cat $PWFile | grep ID: | awk '{print $NF}'`"
DATABASEPassword="`cat $PWFile | grep Password: | awk '{print $NF}'`"
TS=`date +"%Y%m%d-%H%M%S"`
LOG_Folder="/ED/ED8/Script_ED8/_LOG"
LOG1=/ED/ED8/Script_ED8/_LOG/ED8backup-mysql-Auto.log

ED8_Bak_Folder="/ED/ED8/Backup_file"
ED8_Bak_File_Name=$ED8_Bak_Folder/backup-mysql-ED8.gz
ED8_Bak_File_Name_TS=$ED8_Bak_Folder/backup-mysql-ED8-$TS.gz

BAK_Disk_A=/dev/sdb
BAK_Disk_A_Mount_Point="/BAK_Disk_A"
BAK_Disk_A_Hostname_Folder="$BAK_Disk_A_Mount_Point/`hostnamectl | grep "Static hostname" | awk '{print $NF}'`"

BAK_Disk_A_ED8_BAK_Folder="$BAK_Disk_A_Hostname_Folder/ED8/Backup_file"
BAK_Disk_A_ED8_Bak_File_Name_TS="$BAK_Disk_A_ED8_BAK_Folder/backup-mysql-ED8-$TS.gz"

BAK_Disk_B=/dev/sda
BAK_Disk_B_Mount_Point="/BAK_Disk_B"
BAK_Disk_B_Hostname_Folder="$BAK_Disk_B_Mount_Point/`hostnamectl | grep "Static hostname" | awk '{print $NF}'`"

BAK_Disk_B_ED8_BAK_Folder="$BAK_Disk_B_Hostname_Folder/ED8/Backup_file"
BAK_Disk_B_ED8_Bak_File_Name_TS="$BAK_Disk_B_ED8_BAK_Folder/backup-mysql-ED8-$TS.gz"


##### FUNC
CHK_PWFile (){
echo -e "\033[32mCheck the mysql password info file exist: \033[0m"
ls $PWFile > /dev/null 2>&1
if [[ $? != 0 ]]; then
echo -e " >> \033[31mFail. $PWFile didn't exist. Please create one. Exit\033[0m" | tee -a $LOG1
echo
echo -e "$PWFile Content example: "
echo -e "Database_Name: db_ed8_"
echo -e "ID: ed"
echo -e "Password: +039*******"
echo
exit
else
echo -e " >> \033[34mPass. $PWFile exist.\033[0m" | tee -a $LOG1
echo -e -n " Check context information accuracy (DATABASEName)\t\t: "
if [[ $DATABASEName == "" ]]; then
echo -e "\033[31mFail. There is no correct info of DATABASEName in $PWFile. Exit\033[0m"
echo
exit
else
echo -e "\033[34mPass. \033[0m"
fi

echo -e -n " Check context information accuracy (DATABASEUser)\t\t: "
if [[ $DATABASEUser == "" ]]; then
echo -e "\033[31mFail. There is no correct info of DATABASEUser in $PWFile. Exit\033[0m"
echo
exit
else
echo -e "\033[34mPass. \033[0m"
fi

echo -e -n " Check context information accuracy (DATABASEPassword)\t: "
if [[ $DATABASEPassword == "" ]]; then
echo -e "\033[31mFail. There is no correct info of DATABASEPassword in $PWFile. Exit\033[0m"
echo
exit
else
echo -e "\033[34mPass. \033[0m"
fi
fi
}

CHK_LOG_Folder (){
echo -e "\033[32mCheck the auto backup log saving folder exist: \033[35m($LOG_Folder) \033[0m"
ls $LOG_Folder > /dev/null 2>&1
if [[ $? != 0 ]]; then
echo -e " >> \033[33mWarning! There is no folder \"$LOG_Folder\". Next will create a new one.\033[0m" | tee -a $LOG1
sudo mkdir -p $LOG_Folder
sudo chown $USER:$USER $LOG_Folder -R
if [[ $? != 0 ]]; then
echo -e " >> \033[41;37mCreate the folder failed. Exit\033[0m"
echo
exit
fi
else
echo -e " >> \033[34mPass. There is a folder \"$LOG_Folder\". \033[0m" | tee -a $LOG1
fi
}

CHK_ED8_Bak_Folder (){
echo -e "\033[32mCheck the local original backup folder exist: \033[35m($ED8_Bak_Folder) \033[0m"
ls $ED8_Bak_Folder > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " >> \033[34mPass. Backup file saving folder: $ED8_Bak_Folder exist, go next.\033[0m" | tee -a $LOG1
else
echo -e " >> \033[33mWarning! There is no Backup file saving folder: $ED8_Bak_Folder, next will create a new one automatically.\033[0m" | tee -a $LOG1
sudo mkdir -p $ED8_Bak_Folder
sudo chown $USER:$USER $ED8_Bak_Folder -R
if [[ $? != 0 ]]; then
echo -e " >> \033[41;37mCreate the folder failed. Exit\033[0m"
echo
exit
fi
fi
}

Mysql_Dump (){
echo -e "\033[32mStarting mysqldump...\033[0m"
echo -e "\033[45;37m==========================================================================================\033[0m" | tee -a $LOG1
echo -e "\033[41;37m Important! Please check below messages for making sure mysqldump be performed exactly. \033[0m" | tee -a $LOG1
/opt/lampp/bin/mysqldump -u $DATABASEUser -p$DATABASEPassword $DATABASEName | gzip > $ED8_Bak_File_Name
# mysqldump -u $DATABASEUser -p$DATABASEPassword $DATABASEName | gzip > $ED8_Bak_File_Name
if [[ $? == 0 ]]; then
echo -e " >> \033[34mPass. mysql dump w/ gzip OK. \033[0m" | tee -a $LOG1
else
echo -e " >> \033[41;37m Fail. mysql dump w/ gzip failed. Exit \033[0m" | tee -a $LOG1
echo -e " >> \033[31m If you got error message, please try to perform below command for debugging\033[0m" | tee -a $LOG1
echo -e " >> \033[31m # sudo /opt/lampp/bin/mysqldump -u ed -p db_ed8_ | gzip > $ED8_Bak_File_Name \033[0m" | tee -a $LOG1
echo
exit
fi
echo -e "\033[45;37m==========================================================================================\033[0m" | tee -a $LOG1
echo -e " Debug message: "
echo -e " \033[32m* mysqldump: Got error: 1045: Access denied for user 'ed'@'localhost' (using password: YES) when trying to connect \033[0m "
echo -e " >> Please check the content of $PWFile"
echo -e "\033[45;37m==========================================================================================\033[0m"

echo -e "\033[32mStarting make a copy with timastamp filename...\033[0m" | tee -a $LOG1
cp $ED8_Bak_File_Name $ED8_Bak_File_Name_TS
if [[ $? == 0 ]]; then
echo -e " >> \033[34mPass. Make a copy OK - \033[35m($ED8_Bak_File_Name_TS) \033[0m" | tee -a $LOG1
else
echo -e " >> \033[41;37mFail. Make a copy failed. Exit\033[0m - \033[35m($ED8_Bak_File_Name_TS) \033[0m" | tee -a $LOG1
echo
exit
fi
}

CHK_BAK_Disk_A (){
echo -e "\033[32mCheck the detection of Backup_Disk_A: \033[35m(lsscsi $BAK_Disk_A) \033[0m"
lsscsi | grep $BAK_Disk_A > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " >> \033[34mPass. The BAK_Disk_A \"$BAK_Disk_A\" be detected by lsscsi. \033[0m" | tee -a $LOG1
else
echo -e " >> \033[41;37mFail. The BAK_Disk_A \"$BAK_Disk_A\" not be detected by lsscsi. Exit \033[0m" | tee -a $LOG1
echo
exit
fi
}

CHK_BAK_Disk_B (){
echo -e "\033[32mCheck the detection of Backup_Disk_A: \033[35m(lsscsi $BAK_Disk_B) \033[0m"
lsscsi | grep $BAK_Disk_B > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " >> \033[34mPass. The BAK_Disk_B \"$BAK_Disk_B\" be detected by lsscsi. \033[0m" | tee -a $LOG1
else
echo -e " >> \033[41;37mFail. The BAK_Disk_B \"$BAK_Disk_B\" not be detected by lsscsi. Exit \033[0m" | tee -a $LOG1
echo
exit
fi
}

CHK_BAK_Disk_A_Mount_Point (){
echo -e "\033[32mCheck the BAK_Disk_A mount point folder exist: \033[35m($BAK_Disk_A_Mount_Point) \033[0m"
ls $BAK_Disk_A_Mount_Point > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " >> \033[34mPass. The BAK_Disk_A mount point exist \"$BAK_Disk_A_Mount_Point\"\033[0m" | tee -a $LOG1
else
echo -e " >> \033[33mWarning! The BAK_Disk_A mount point doesn't exist \"$BAK_Disk_A_Mount_Point\"\033[0m, auto create a new one. " | tee -a $LOG1
sudo mkdir -p $BAK_Disk_A_Mount_Point
sudo chown $USER:$USER $BAK_Disk_A_Mount_Point -R
if [[ $? != 0 ]]; then
echo -e " >> \033[41;37mCreate the folder failed. Exit\033[0m"
echo
exit
fi

fi
}

CHK_BAK_Disk_B_Mount_Point (){
echo -e "\033[32mCheck the BAK_Disk_A mount point folder exist: \033[35m($BAK_Disk_B_Mount_Point) \033[0m"
ls $BAK_Disk_B_Mount_Point > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " >> \033[34mPass. The BAK_Disk_B mount point exist \"$BAK_Disk_B_Mount_Point\"\033[0m" | tee -a $LOG1
else
echo -e " >> \033[33mWarning! The BAK_Disk_B mount point doesn't exist \"$BAK_Disk_B_Mount_Point\"\033[0m, auto create a new one. " | tee -a $LOG1
sudo mkdir -p $BAK_Disk_B_Mount_Point
sudo chown $USER:$USER $BAK_Disk_B_Mount_Point -R
if [[ $? != 0 ]]; then
echo -e " >> \033[41;37mCreate the folder failed. Exit\033[0m"
echo
exit
fi

fi
}

CHK_BAK_Disk_A_Mount_Status (){
echo -e "\033[32mCheck the BAK_Disk_A mount status: \033[0m"
if [[ `df -h | grep $BAK_Disk_A | awk '{print $NF}'` != $BAK_Disk_A_Mount_Point ]]; then
echo -e " >> \033[31mFail. The BAK_Disk_A ($BAK_Disk_A) not be mounted at \"$BAK_Disk_A_Mount_Point\". Exit. \033[0m" | tee -a $LOG1
df -h
echo
exit
else
echo -e " >> \033[34mPass. The BAK_Disk_A ($BAK_Disk_A) be mounted at \"$BAK_Disk_A_Mount_Point\"\033[0m" | tee -a $LOG1
fi
}

CHK_BAK_Disk_B_Mount_Status (){
echo -e "\033[32mCheck the BAK_Disk_B mount status: \033[0m"
if [[ `df -h | grep $BAK_Disk_B | awk '{print $NF}'` != $BAK_Disk_B_Mount_Point ]]; then
echo -e " >> \033[31mFail. The BAK_Disk_B ($BAK_Disk_B) not be mounted at \"$BAK_Disk_B_Mount_Point\". Exit. \033[0m" | tee -a $LOG1
df -h
echo
exit
else
echo -e " >> \033[34mPass. The BAK_Disk_B ($BAK_Disk_B) be mounted at \"$BAK_Disk_B_Mount_Point\"\033[0m" | tee -a $LOG1
fi
}

CHK_BAK_Disk_A_Hostname_Folder (){
echo -e "\033[32mCheck the BAK_Disk_A Hostname folder status: \033[35m($BAK_Disk_A_Hostname_Folder) \033[0m"
ls $BAK_Disk_A_Hostname_Folder > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " >> \033[34mPass. BAK_Disk_A Hostname folder: $BAK_Disk_A_Hostname_Folder exist, go next.\033[0m" | tee -a $LOG1
else
echo -e " >> \033[33mWarning! BAK_Disk_A Hostname folder: $BAK_Disk_A_Hostname_Folder, next will create a new one automatically.\033[0m" | tee -a $LOG1
sduo mkdir -p $BAK_Disk_A_Hostname_Folder
sudo chown $USER:$USER $BAK_Disk_A_Hostname_Folder -R
if [[ $? != 0 ]]; then
echo -e " >> \033[41;37mCreate the folder failed. Exit\033[0m"
echo
exit
fi
fi
}

CHK_BAK_Disk_B_Hostname_Folder (){
echo -e "\033[32mCheck the BAK_Disk_B Hostname folder status: \033[35m($BAK_Disk_B_Hostname_Folder) \033[0m"
ls $BAK_Disk_B_Hostname_Folder > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " >> \033[34mPass. BAK_Disk_B Hostname folder: $BAK_Disk_B_Hostname_Folder exist, go next.\033[0m" | tee -a $LOG1
else
echo -e " >> \033[31mWarning! BAK_Disk_B Hostname folder: $BAK_Disk_B_Hostname_Folder, next will create a new one automatically.\033[0m" | tee -a $LOG1
sudo mkdir -p $BAK_Disk_B_Hostname_Folder
sudo chown $USER:$USER $BAK_Disk_B_Hostname_Folder -R
if [[ $? != 0 ]]; then
echo -e " >> \033[41;37mCreate the folder failed. Exit\033[0m"
echo
exit
fi
fi
}

CHK_BAK_Disk_A_ED8_BAK_Folder (){
echo -e "\033[32mCheck the BAK_Disk_A ED8 backup folder status: \033[35m($BAK_Disk_A_ED8_BAK_Folder) \033[0m"
ls $BAK_Disk_A_ED8_BAK_Folder > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " >> \033[34mPass. BAK_Disk's Backup file saving folder: $BAK_Disk_A_ED8_BAK_Folder exist, go next.\033[0m" | tee -a $LOG1
else
echo -e " >> \033[33mWarning! There is no BAK_Disk's Backup file saving folder: $BAK_Disk_A_ED8_BAK_Folder, next will create a new one automatically.\033[0m" | tee -a $LOG1
sudo mkdir -p $BAK_Disk_A_ED8_BAK_Folder
sudo chown $USER:$USER $BAK_Disk_A_ED8_BAK_Folder -R
if [[ $? != 0 ]]; then
echo -e " >> \033[41;37mCreate the folder failed. Exit\033[0m"
echo
exit
fi
fi
}

CHK_BAK_Disk_B_ED8_BAK_Folder (){
echo -e "\033[32mCheck the BAK_Disk_B ED8 backup folder status: \033[35m($BAK_Disk_B_ED8_BAK_Folder) \033[0m"
ls $BAK_Disk_B_ED8_BAK_Folder > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " >> \033[34mPass. BAK_Disk's Backup file saving folder: $BAK_Disk_B_ED8_BAK_Folder exist, go next.\033[0m" | tee -a $LOG1
else
echo -e " >> \033[33mWarning! There is no BAK_Disk's Backup file saving folder: $BAK_Disk_B_ED8_BAK_Folder, next will create a new one automatically.\033[0m" | tee -a $LOG1
sudo mkdir -p $BAK_Disk_B_ED8_BAK_Folder
sudo chown $USER:$USER $BAK_Disk_B_ED8_BAK_Folder -R

if [[ $? != 0 ]]; then
echo -e " >> \033[41;37mCreate the folder failed. Exit\033[0m"
echo
exit
fi
fi
}

CP_TO_BAK_Disk_A (){
echo -e "\033[32mCopy the backup files to Backup_Disk_A...\033[0m"
cp $ED8_Bak_File_Name_TS $BAK_Disk_A_ED8_Bak_File_Name_TS
if [[ $? == 0 ]]; then
echo -e " >> \033[34mPass. Make a copy OK - \033[35m($BAK_Disk_A_ED8_Bak_File_Name_TS) \033[0m" | tee -a $LOG1
else
echo -e " >> \033[41;37mFail. Make a copy failed. Exit\033[0m - \033[35m($BAK_Disk_A_ED8_Bak_File_Name_TS) \033[0m" | tee -a $LOG1
echo
echo -e " \033[35mIf you got (Permission denied) message, please perform below command and re-do again. \033[0m"
echo -e " \033[35mIt happened at fist backup, caused from created disk mount point folder ($BAK_Disk_A_Mount_Point) with sudo \033[0m"
echo -e " \033[41;37m# sudo chown $USER:$USER $BAK_Disk_A_Mount_Point \033[0m"
echo
exit
fi
}

CP_TO_BAK_Disk_B (){
echo -e "\033[32mCopy the backup files to Backup_Disk_B...\033[0m"
cp $ED8_Bak_File_Name_TS $BAK_Disk_B_ED8_Bak_File_Name_TS
if [[ $? == 0 ]]; then
echo -e " >> \033[34mPass. Make a copy OK - \033[35m($BAK_Disk_B_ED8_Bak_File_Name_TS) \033[0m" | tee -a $LOG1
else
echo -e " >> \033[41;37mFail. Make a copy failed. Exit\033[0m - \033[35m($BAK_Disk_B_ED8_Bak_File_Name_TS) \033[0m" | tee -a $LOG1
echo
echo -e " \033[35mIf you got (Permission denied) message, please perform below command and re-do again. \033[0m"
echo -e " \033[35mIt happened at fist backup, caused from created disk mount point folder ($BAK_Disk_B_Mount_Point) with sudo \033[0m"
echo -e " \033[41;37m# sudo chown $USER:$USER $BAK_Disk_B_Mount_Point \033[0m"
echo
exit
fi
}

echo -e "===== `date +"%Y/%m/%d %H:%M:%S"` ===== \033[45;37m$0\033[0m =====" | tee -a $LOG1
CHK_PWFile
CHK_LOG_Folder
CHK_ED8_Bak_Folder
Mysql_Dump
#CHK_BAK_Disk_A
#CHK_BAK_Disk_A_Mount_Point
#CHK_BAK_Disk_A_Mount_Status
#CHK_BAK_Disk_A_Hostname_Folder
#CHK_BAK_Disk_A_ED8_BAK_Folder
#CP_TO_BAK_Disk_A
#CHK_BAK_Disk_B
#CHK_BAK_Disk_B_Mount_Point
#CHK_BAK_Disk_B_Mount_Status
#CHK_BAK_Disk_B_Hostname_Folder
#CHK_BAK_Disk_B_ED8_BAK_Folder
#CP_TO_BAK_Disk_B


echo
echo -e "\033[33mIf you want to check the LOG, please perform below command: "
echo -e " # cat $LOG1\033[0m"
echo

+ 347
- 0
ED8backup-mysql-Auto.sh.TMP 파일 보기

@@ -0,0 +1,347 @@
#!/bin/bash
USER=`whoami`
PWFile="/home/$USER/PW/mysql_ED8.info"
DATABASEName="`cat $PWFile | grep Database_Name: | awk '{print $NF}'`"
DATABASEUser="`cat $PWFile | grep ID: | awk '{print $NF}'`"
DATABASEPassword="`cat $PWFile | grep Password: | awk '{print $NF}'`"
TS=`date +"%Y%m%d-%H%M%S"`
LOG_Folder="/ED/ED8/Script_ED8/_LOG"
LOG1=/ED/ED8/Script_ED8/_LOG/ED8backup-mysql-Auto.log

ED8_Bak_Folder="/ED/ED8/Backup_file"
ED8_Bak_File_Name=$ED8_Bak_Folder/backup-mysql-ED8.gz
ED8_Bak_File_Name_TS=$ED8_Bak_Folder/backup-mysql-ED8-$TS.gz

BAK_Disk_A=/dev/sdb
BAK_Disk_A_Mount_Point="/BAK_Disk_A"
BAK_Disk_A_Hostname_Folder="$BAK_Disk_A_Mount_Point/`hostnamectl | grep "Static hostname" | awk '{print $NF}'`"

BAK_Disk_A_ED8_BAK_Folder="$BAK_Disk_A_Hostname_Folder/ED8/Backup_file"
BAK_Disk_A_ED8_Bak_File_Name_TS="$BAK_Disk_A_ED8_BAK_Folder/backup-mysql-ED8-$TS.gz"

BAK_Disk_B=/dev/sda
BAK_Disk_B_Mount_Point="/BAK_Disk_B"
BAK_Disk_B_Hostname_Folder="$BAK_Disk_B_Mount_Point/`hostnamectl | grep "Static hostname" | awk '{print $NF}'`"

BAK_Disk_B_ED8_BAK_Folder="$BAK_Disk_B_Hostname_Folder/ED8/Backup_file"
BAK_Disk_B_ED8_Bak_File_Name_TS="$BAK_Disk_B_ED8_BAK_Folder/backup-mysql-ED8-$TS.gz"


##### FUNC
CHK_PWFile (){
echo -e "\033[32mCheck the mysql password info file exist: \033[0m"
ls $PWFile > /dev/null 2>&1
if [[ $? != 0 ]]; then
echo -e " >> \033[31mFail. $PWFile didn't exist. Please create one. Exit\033[0m" | tee -a $LOG1
echo
echo -e "$PWFile Content example: "
echo -e "Database_Name: db_ed8_"
echo -e "ID: root"
echo -e "Password: +039*******"
echo
exit
else
echo -e " >> \033[34mPass. $PWFile exist.\033[0m" | tee -a $LOG1
echo -e -n " Check context information accuracy (DATABASEName)\t\t: "
if [[ $DATABASEName == "" ]]; then
echo -e "\033[31mFail. There is no correct info of DATABASEName in $PWFile. Exit\033[0m"
echo
exit
else
echo -e "\033[34mPass. \033[0m"
fi

echo -e -n " Check context information accuracy (DATABASEUser)\t\t: "
if [[ $DATABASEUser == "" ]]; then
echo -e "\033[31mFail. There is no correct info of DATABASEUser in $PWFile. Exit\033[0m"
echo
exit
else
echo -e "\033[34mPass. \033[0m"
fi

echo -e -n " Check context information accuracy (DATABASEPassword)\t: "
if [[ $DATABASEPassword == "" ]]; then
echo -e "\033[31mFail. There is no correct info of DATABASEPassword in $PWFile. Exit\033[0m"
echo
exit
else
echo -e "\033[34mPass. \033[0m"
fi
fi
}

CHK_LOG_Folder (){
echo -e "\033[32mCheck the auto backup log saving folder exist: \033[35m($LOG_Folder) \033[0m"
ls $LOG_Folder > /dev/null 2>&1
if [[ $? != 0 ]]; then
echo -e " >> \033[33mWarning! There is no folder \"$LOG_Folder\". Next will create a new one.\033[0m" | tee -a $LOG1
sudo mkdir -p $LOG_Folder
chown $USER:$USER $LOG_Folder -R
if [[ $? != 0 ]]; then
echo -e " >> \033[41;37mCreate the folder failed. Exit\033[0m"
echo
exit
fi
else
echo -e " >> \033[34mPass. There is a folder \"$LOG_Folder\". \033[0m" | tee -a $LOG1
fi
}

CHK_ED8_Bak_Folder (){
echo -e "\033[32mCheck the local original backup folder exist: \033[35m($ED8_Bak_Folder) \033[0m"
ls $ED8_Bak_Folder > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " >> \033[34mPass. Backup file saving folder: $ED8_Bak_Folder exist, go next.\033[0m" | tee -a $LOG1
else
echo -e " >> \033[33mWarning! There is no Backup file saving folder: $ED8_Bak_Folder, next will create a new one automatically.\033[0m" | tee -a $LOG1
sudo mkdir -p $ED8_Bak_Folder
chown $USER:$USER $ED8_Bak_Folder -R
if [[ $? != 0 ]]; then
echo -e " >> \033[41;37mCreate the folder failed. Exit\033[0m"
echo
exit
fi
fi
}

Mysql_Dump (){
echo -e "\033[32mStarting mysqldump...\033[0m"
echo -e "\033[45;37m==========================================================================================\033[0m" | tee -a $LOG1
echo -e "\033[41;37m Important! Please check below messages for making sure mysqldump be performed exactly. \033[0m" | tee -a $LOG1
mysqldump -u $DATABASEUser -p$DATABASEPassword $DATABASEName | gzip > $ED8_Bak_File_Name
# mysqldump -u $DATABASEUser -p$DATABASEPassword $DATABASEName | gzip > $ED8_Bak_File_Name
if [[ $? == 0 ]]; then
echo -e " >> \033[34mPass. mysql dump w/ gzip OK. \033[0m" | tee -a $LOG1
else
echo -e " >> \033[41;37m Fail. mysql dump w/ gzip failed. Exit \033[0m" | tee -a $LOG1
echo -e " >> \033[31m If you got error message, please try to perform below command for debugging\033[0m" | tee -a $LOG1
echo -e " >> \033[31m # sudo mysqldump -u ed -p db_ed8_ | gzip > $ED8_Bak_File_Name \033[0m" | tee -a $LOG1
echo
exit
fi
echo -e "\033[45;37m==========================================================================================\033[0m" | tee -a $LOG1
echo -e " Debug message: "
echo -e " \033[31m* mysqldump: Got error: 1045: Access denied for user 'root'@'localhost' (using password: YES) when trying to connect \033[0m "
echo -e " >> Please check the content of $PWFile"
echo -e "\033[45;37m==========================================================================================\033[0m"

echo -e "\033[32mStarting make a copy with timastamp filename...\033[0m" | tee -a $LOG1
cp $ED8_Bak_File_Name $ED8_Bak_File_Name_TS
if [[ $? == 0 ]]; then
echo -e " >> \033[34mPass. Make a copy OK - \033[35m($ED8_Bak_File_Name_TS) \033[0m" | tee -a $LOG1
else
echo -e " >> \033[41;37mFail. Make a copy failed. Exit\033[0m - \033[35m($ED8_Bak_File_Name_TS) \033[0m" | tee -a $LOG1
echo
exit
fi
}

CHK_BAK_Disk_A (){
echo -e "\033[32mCheck the detection of Backup_Disk_A: \033[35m(lsscsi $BAK_Disk_A) \033[0m"
lsscsi | grep $BAK_Disk_A > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " >> \033[34mPass. The BAK_Disk_A \"$BAK_Disk_A\" be detected by lsscsi. \033[0m" | tee -a $LOG1
else
echo -e " >> \033[41;37mFail. The BAK_Disk_A \"$BAK_Disk_A\" not be detected by lsscsi. Exit \033[0m" | tee -a $LOG1
echo
exit
fi
}

CHK_BAK_Disk_B (){
echo -e "\033[32mCheck the detection of Backup_Disk_A: \033[35m(lsscsi $BAK_Disk_B) \033[0m"
lsscsi | grep $BAK_Disk_B > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " >> \033[34mPass. The BAK_Disk_B \"$BAK_Disk_B\" be detected by lsscsi. \033[0m" | tee -a $LOG1
else
echo -e " >> \033[41;37mFail. The BAK_Disk_B \"$BAK_Disk_B\" not be detected by lsscsi. Exit \033[0m" | tee -a $LOG1
echo
exit
fi
}

CHK_BAK_Disk_A_Mount_Point (){
echo -e "\033[32mCheck the BAK_Disk_A mount point folder exist: \033[35m($BAK_Disk_A_Mount_Point) \033[0m"
ls $BAK_Disk_A_Mount_Point > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " >> \033[34mPass. The BAK_Disk_A mount point exist \"$BAK_Disk_A_Mount_Point\"\033[0m" | tee -a $LOG1
else
echo -e " >> \033[33mWarning! The BAK_Disk_A mount point doesn't exist \"$BAK_Disk_A_Mount_Point\"\033[0m, auto create a new one. " | tee -a $LOG1
sudo mkdir -p $BAK_Disk_A_Mount_Point
chown $USER:$USER $BAK_Disk_A_Mount_Point -R
if [[ $? != 0 ]]; then
echo -e " >> \033[41;37mCreate the folder failed. Exit\033[0m"
echo
exit
fi

fi
}

CHK_BAK_Disk_B_Mount_Point (){
echo -e "\033[32mCheck the BAK_Disk_A mount point folder exist: \033[35m($BAK_Disk_B_Mount_Point) \033[0m"
ls $BAK_Disk_B_Mount_Point > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " >> \033[34mPass. The BAK_Disk_B mount point exist \"$BAK_Disk_B_Mount_Point\"\033[0m" | tee -a $LOG1
else
echo -e " >> \033[33mWarning! The BAK_Disk_B mount point doesn't exist \"$BAK_Disk_B_Mount_Point\"\033[0m, auto create a new one. " | tee -a $LOG1
sudo mkdir -p $BAK_Disk_B_Mount_Point
chown $USER:$USER $BAK_Disk_B_Mount_Point -R
if [[ $? != 0 ]]; then
echo -e " >> \033[41;37mCreate the folder failed. Exit\033[0m"
echo
exit
fi

fi
}

CHK_BAK_Disk_A_Mount_Status (){
echo -e "\033[32mCheck the BAK_Disk_A mount status: \033[0m"
if [[ `df -h | grep $BAK_Disk_A | awk '{print $NF}'` != $BAK_Disk_A_Mount_Point ]]; then
echo -e " >> \033[31mFail. The BAK_Disk_A ($BAK_Disk_A) not be mounted at \"$BAK_Disk_A_Mount_Point\". Exit. \033[0m" | tee -a $LOG1
df -h
echo
exit
else
echo -e " >> \033[34mPass. The BAK_Disk_A ($BAK_Disk_A) be mounted at \"$BAK_Disk_A_Mount_Point\"\033[0m" | tee -a $LOG1
fi
}

CHK_BAK_Disk_B_Mount_Status (){
echo -e "\033[32mCheck the BAK_Disk_B mount status: \033[0m"
if [[ `df -h | grep $BAK_Disk_B | awk '{print $NF}'` != $BAK_Disk_B_Mount_Point ]]; then
echo -e " >> \033[31mFail. The BAK_Disk_B ($BAK_Disk_B) not be mounted at \"$BAK_Disk_B_Mount_Point\". Exit. \033[0m" | tee -a $LOG1
df -h
echo
exit
else
echo -e " >> \033[34mPass. The BAK_Disk_B ($BAK_Disk_B) be mounted at \"$BAK_Disk_B_Mount_Point\"\033[0m" | tee -a $LOG1
fi
}

CHK_BAK_Disk_A_Hostname_Folder (){
echo -e "\033[32mCheck the BAK_Disk_A Hostname folder status: \033[35m($BAK_Disk_A_Hostname_Folder) \033[0m"
ls $BAK_Disk_A_Hostname_Folder > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " >> \033[34mPass. BAK_Disk_A Hostname folder: $BAK_Disk_A_Hostname_Folder exist, go next.\033[0m" | tee -a $LOG1
else
echo -e " >> \033[33mWarning! BAK_Disk_A Hostname folder: $BAK_Disk_A_Hostname_Folder, next will create a new one automatically.\033[0m" | tee -a $LOG1
sduo mkdir -p $BAK_Disk_A_Hostname_Folder
chown $USER:$USER $BAK_Disk_A_Hostname_Folder -R
if [[ $? != 0 ]]; then
echo -e " >> \033[41;37mCreate the folder failed. Exit\033[0m"
echo
exit
fi
fi
}

CHK_BAK_Disk_B_Hostname_Folder (){
echo -e "\033[32mCheck the BAK_Disk_B Hostname folder status: \033[35m($BAK_Disk_B_Hostname_Folder) \033[0m"
ls $BAK_Disk_B_Hostname_Folder > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " >> \033[34mPass. BAK_Disk_B Hostname folder: $BAK_Disk_B_Hostname_Folder exist, go next.\033[0m" | tee -a $LOG1
else
echo -e " >> \033[31mWarning! BAK_Disk_B Hostname folder: $BAK_Disk_B_Hostname_Folder, next will create a new one automatically.\033[0m" | tee -a $LOG1
sudo mkdir -p $BAK_Disk_B_Hostname_Folder
chown $USER:$USER $BAK_Disk_B_Hostname_Folder -R
if [[ $? != 0 ]]; then
echo -e " >> \033[41;37mCreate the folder failed. Exit\033[0m"
echo
exit
fi
fi
}

CHK_BAK_Disk_A_ED8_BAK_Folder (){
echo -e "\033[32mCheck the BAK_Disk_A ED8 backup folder status: \033[35m($BAK_Disk_A_ED8_BAK_Folder) \033[0m"
ls $BAK_Disk_A_ED8_BAK_Folder > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " >> \033[34mPass. BAK_Disk's Backup file saving folder: $BAK_Disk_A_ED8_BAK_Folder exist, go next.\033[0m" | tee -a $LOG1
else
echo -e " >> \033[33mWarning! There is no BAK_Disk's Backup file saving folder: $BAK_Disk_A_ED8_BAK_Folder, next will create a new one automatically.\033[0m" | tee -a $LOG1
sudo mkdir -p $BAK_Disk_A_ED8_BAK_Folder
chown $USER:$USER $BAK_Disk_A_ED8_BAK_Folder -R
if [[ $? != 0 ]]; then
echo -e " >> \033[41;37mCreate the folder failed. Exit\033[0m"
echo
exit
fi
fi
}

CHK_BAK_Disk_B_ED8_BAK_Folder (){
echo -e "\033[32mCheck the BAK_Disk_B ED8 backup folder status: \033[35m($BAK_Disk_B_ED8_BAK_Folder) \033[0m"
ls $BAK_Disk_B_ED8_BAK_Folder > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " >> \033[34mPass. BAK_Disk's Backup file saving folder: $BAK_Disk_B_ED8_BAK_Folder exist, go next.\033[0m" | tee -a $LOG1
else
echo -e " >> \033[33mWarning! There is no BAK_Disk's Backup file saving folder: $BAK_Disk_B_ED8_BAK_Folder, next will create a new one automatically.\033[0m" | tee -a $LOG1
sudo mkdir -p $BAK_Disk_B_ED8_BAK_Folder
chown $USER:$USER $BAK_Disk_B_ED8_BAK_Folder -R

if [[ $? != 0 ]]; then
echo -e " >> \033[41;37mCreate the folder failed. Exit\033[0m"
echo
exit
fi
fi
}

CP_TO_BAK_Disk_A (){
echo -e "\033[32mCopy the backup files to Backup_Disk_A...\033[0m"
cp $ED8_Bak_File_Name_TS $BAK_Disk_A_ED8_Bak_File_Name_TS
if [[ $? == 0 ]]; then
echo -e " >> \033[34mPass. Make a copy OK - \033[35m($BAK_Disk_A_ED8_Bak_File_Name_TS) \033[0m" | tee -a $LOG1
else
echo -e " >> \033[41;37mFail. Make a copy failed. Exit\033[0m - \033[35m($BAK_Disk_A_ED8_Bak_File_Name_TS) \033[0m" | tee -a $LOG1
echo
echo -e " \033[35mIf you got (Permission denied) message, please perform below command and re-do again. \033[0m"
echo -e " \033[35mIt happened at fist backup, caused from created disk mount point folder ($BAK_Disk_A_Mount_Point) with sudo \033[0m"
echo -e " \033[41;37m# chown $USER:$USER $BAK_Disk_A_Mount_Point \033[0m"
echo
exit
fi
}

CP_TO_BAK_Disk_B (){
echo -e "\033[32mCopy the backup files to Backup_Disk_B...\033[0m"
cp $ED8_Bak_File_Name_TS $BAK_Disk_B_ED8_Bak_File_Name_TS
if [[ $? == 0 ]]; then
echo -e " >> \033[34mPass. Make a copy OK - \033[35m($BAK_Disk_B_ED8_Bak_File_Name_TS) \033[0m" | tee -a $LOG1
else
echo -e " >> \033[41;37mFail. Make a copy failed. Exit\033[0m - \033[35m($BAK_Disk_B_ED8_Bak_File_Name_TS) \033[0m" | tee -a $LOG1
echo
echo -e " \033[35mIf you got (Permission denied) message, please perform below command and re-do again. \033[0m"
echo -e " \033[35mIt happened at fist backup, caused from created disk mount point folder ($BAK_Disk_B_Mount_Point) with sudo \033[0m"
echo -e " \033[41;37m# chown $USER:$USER $BAK_Disk_B_Mount_Point \033[0m"
echo
exit
fi
}

echo -e "===== `date +"%Y/%m/%d %H:%M:%S"` ===== \033[45;37m$0\033[0m =====" | tee -a $LOG1
CHK_PWFile
CHK_LOG_Folder
CHK_ED8_Bak_Folder
Mysql_Dump
CHK_BAK_Disk_A
CHK_BAK_Disk_A_Mount_Point
CHK_BAK_Disk_A_Mount_Status
CHK_BAK_Disk_A_Hostname_Folder
CHK_BAK_Disk_A_ED8_BAK_Folder
CP_TO_BAK_Disk_A
CHK_BAK_Disk_B
CHK_BAK_Disk_B_Mount_Point
CHK_BAK_Disk_B_Mount_Status
CHK_BAK_Disk_B_Hostname_Folder
CHK_BAK_Disk_B_ED8_BAK_Folder
CP_TO_BAK_Disk_B


echo
echo -e "\033[33mIf you want to check the LOG, please perform below command: "
echo -e " # cat $LOG1\033[0m"
echo

+ 63
- 0
ED8restore_from_local-mysql.sh 파일 보기

@@ -0,0 +1,63 @@
#!/bin/bash
ED8_Database_Name=db_ed8_
TMP_File=/ED/ED8/ED8restore_from_local.pw

read -p "Please enter the user name of mysql $ED8_Database_Name: " edname
echo -e "ID\t$edname" > $TMP_File
read -p "Please enter the password of mysql $ED8_Database_Name: " edpw
echo -e "Password\t$edpw" >> $TMP_File

LOG1=/ED/ED8/Script_ED8/_LOG/ED8restore_from_local-mysql.log

edID=`cat $TMP_File | grep "ID" | awk '{print $NF}'`
edPW=`cat $TMP_File | grep "Password" | awk '{print $NF}'`

echo -e "\033[32mBelow are all saved mysql backup files \033[0m"
ls /ED/ED8/Backup_file/ -al | grep backup-mysql-ED8
echo
echo -e -n "\033[33mWhich file do you want to restore? \033[0m"
read DATABASE_BAK_File_NAME
ls /ED/ED8/Backup_file/$DATABASE_BAK_File_NAME > /dev/null 2>&1
if [[ $? != 0 ]]; then
echo -e "\033[41;37mFail. The file ($DATABASE_BAK_File_NAME) doesn't exist. Exit \033[0m"
echo
exit
else
echo -e "\033[34mPass. The file ($DATABASE_BAK_File_NAME) exist, go next..."
fi


echo "======= `date +"%Y/%m/%d %H:%M:%S"` ==========================" | tee -a $LOG1
echo "`date +"%Y/%m/%d %H:%M:%S"` - Starting restore ED8 mysql from dumped files" | tee -a $LOG1

mysql -u $edID -p$edPW -e 'show databases;'
mysql -u $edID -p$edPW -e 'show databases;' | grep $ED8_Database_Name | wc -l > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e "\033[44;37m1/2: The database named $ED8_Database_Name exist, go next\033[0m" | tee -a $LOG1
else
echo "\033[45;37m1/2: There is no database named $ED8_Database_Name, next will create a new one automatically.\033[0m" | tee -a $LOG1
expect -c "
spawn sudo mysql -u $edID -p -e \"CREATE DATABASE IF NOT EXISTS $ED8_Database_Name\"
expect \"password for ed:\"
send \"$edPW\r\"
expect \"Enter password:\"
send \"$edPW\r\"
expect eof"
sleep 2
fi

#sudo mysql -u $edID -p $ED8_Database_Name < /ED/ED8/Backup_file/backup.sql
#mysql -u $edID -p$edPW $ED8_Database_Name < /ED/ED8/Backup_file/backup.sql
gunzip -c /ED/ED8/Backup_file/$DATABASE_BAK_File_NAME | mysql -u $edID -p$edpw $ED8_Database_Name #with gzip restore
if [[ $? == 0 ]]; then
echo -e "\033[44;37m2/2: Restored mysql. Finished\033[0m" | tee -a $LOG1
else
echo -e "\033[41;37m2/2: Restore mysql failed.\033[0m" | tee -a $LOG1
fi

rm $TMP_File
echo | tee -a $LOG1

echo -e "If you want to check the LOG, please perform below command: "
echo -e " \033[35m# cat $LOG1 \033[0m"
echo

+ 63
- 0
ED8restore_from_local-mysql.sh.SRC 파일 보기

@@ -0,0 +1,63 @@
#!/bin/bash
ED8_Database_Name=db_ed8_
TMP_File=/ED/ED8/ED8restore_from_local.pw

read -p "Please enter the user name of mysql $ED8_Database_Name: " edname
echo -e "ID\t$edname" > $TMP_File
read -p "Please enter the password of mysql $ED8_Database_Name: " edpw
echo -e "Password\t$edpw" >> $TMP_File

LOG1=/ED/ED8/Script_ED8/_LOG/ED8restore_from_local-mysql.log

edID=`cat $TMP_File | grep "ID" | awk '{print $NF}'`
edPW=`cat $TMP_File | grep "Password" | awk '{print $NF}'`

echo -e "\033[32mBelow are all saved mysql backup files \033[0m"
ls /ED/ED8/Backup_file/ -al | grep backup-mysql-ED8
echo
echo -e -n "\033[33mWhich file do you want to restore? \033[0m"
read DATABASE_BAK_File_NAME
ls /ED/ED8/Backup_file/$DATABASE_BAK_File_NAME > /dev/null 2>&1
if [[ $? != 0 ]]; then
echo -e "\033[41;37mFail. The file ($DATABASE_BAK_File_NAME) doesn't exist. Exit \033[0m"
echo
exit
else
echo -e "\033[34mPass. The file ($DATABASE_BAK_File_NAME) exist, go next..."
fi


echo "======= `date +"%Y/%m/%d %H:%M:%S"` ==========================" | tee -a $LOG1
echo "`date +"%Y/%m/%d %H:%M:%S"` - Starting restore ED8 mysql from dumped files" | tee -a $LOG1

/opt/lampp/bin/mysql -u $edID -p$edPW -e 'show databases;'
/opt/lampp/bin/mysql -u $edID -p$edPW -e 'show databases;' | grep $ED8_Database_Name | wc -l > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e "\033[44;37m1/2: The database named $ED8_Database_Name exist, go next\033[0m" | tee -a $LOG1
else
echo "\033[45;37m1/2: There is no database named $ED8_Database_Name, next will create a new one automatically.\033[0m" | tee -a $LOG1
expect -c "
spawn sudo /opt/lampp/bin/mysql -u $edID -p -e \"CREATE DATABASE IF NOT EXISTS $ED8_Database_Name\"
expect \"password for ed:\"
send \"$edPW\r\"
expect \"Enter password:\"
send \"$edPW\r\"
expect eof"
sleep 2
fi

#sudo /opt/lampp/bin/mysql -u $edID -p $ED8_Database_Name < /ED/ED8/Backup_file/backup.sql
#/opt/lampp/bin/mysql -u $edID -p$edPW $ED8_Database_Name < /ED/ED8/Backup_file/backup.sql
gunzip -c /ED/ED8/Backup_file/$DATABASE_BAK_File_NAME | /opt/lampp/bin/mysql -u $edID -p$edpw $ED8_Database_Name #with gzip restore
if [[ $? == 0 ]]; then
echo -e "\033[44;37m2/2: Restored mysql. Finished\033[0m" | tee -a $LOG1
else
echo -e "\033[41;37m2/2: Restore mysql failed.\033[0m" | tee -a $LOG1
fi

rm $TMP_File
echo | tee -a $LOG1

echo -e "If you want to check the LOG, please perform below command: "
echo -e " \033[35m# cat $LOG1 \033[0m"
echo

+ 63
- 0
ED8restore_from_local-mysql.sh.TMP 파일 보기

@@ -0,0 +1,63 @@
#!/bin/bash
ED8_Database_Name=db_ed8_
TMP_File=/ED/ED8/ED8restore_from_local.pw

read -p "Please enter the user name of mysql $ED8_Database_Name: " edname
echo -e "ID\t$edname" > $TMP_File
read -p "Please enter the password of mysql $ED8_Database_Name: " edpw
echo -e "Password\t$edpw" >> $TMP_File

LOG1=/ED/ED8/Script_ED8/_LOG/ED8restore_from_local-mysql.log

edID=`cat $TMP_File | grep "ID" | awk '{print $NF}'`
edPW=`cat $TMP_File | grep "Password" | awk '{print $NF}'`

echo -e "\033[32mBelow are all saved mysql backup files \033[0m"
ls /ED/ED8/Backup_file/ -al | grep backup-mysql-ED8
echo
echo -e -n "\033[33mWhich file do you want to restore? \033[0m"
read DATABASE_BAK_File_NAME
ls /ED/ED8/Backup_file/$DATABASE_BAK_File_NAME > /dev/null 2>&1
if [[ $? != 0 ]]; then
echo -e "\033[41;37mFail. The file ($DATABASE_BAK_File_NAME) doesn't exist. Exit \033[0m"
echo
exit
else
echo -e "\033[34mPass. The file ($DATABASE_BAK_File_NAME) exist, go next..."
fi


echo "======= `date +"%Y/%m/%d %H:%M:%S"` ==========================" | tee -a $LOG1
echo "`date +"%Y/%m/%d %H:%M:%S"` - Starting restore ED8 mysql from dumped files" | tee -a $LOG1

mysql -u $edID -p$edPW -e 'show databases;'
mysql -u $edID -p$edPW -e 'show databases;' | grep $ED8_Database_Name | wc -l > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e "\033[44;37m1/2: The database named $ED8_Database_Name exist, go next\033[0m" | tee -a $LOG1
else
echo "\033[45;37m1/2: There is no database named $ED8_Database_Name, next will create a new one automatically.\033[0m" | tee -a $LOG1
expect -c "
spawn sudo mysql -u $edID -p -e \"CREATE DATABASE IF NOT EXISTS $ED8_Database_Name\"
expect \"password for ed:\"
send \"$edPW\r\"
expect \"Enter password:\"
send \"$edPW\r\"
expect eof"
sleep 2
fi

#sudo mysql -u $edID -p $ED8_Database_Name < /ED/ED8/Backup_file/backup.sql
#mysql -u $edID -p$edPW $ED8_Database_Name < /ED/ED8/Backup_file/backup.sql
gunzip -c /ED/ED8/Backup_file/$DATABASE_BAK_File_NAME | mysql -u $edID -p$edpw $ED8_Database_Name #with gzip restore
if [[ $? == 0 ]]; then
echo -e "\033[44;37m2/2: Restored mysql. Finished\033[0m" | tee -a $LOG1
else
echo -e "\033[41;37m2/2: Restore mysql failed.\033[0m" | tee -a $LOG1
fi

rm $TMP_File
echo | tee -a $LOG1

echo -e "If you want to check the LOG, please perform below command: "
echo -e " \033[35m# cat $LOG1 \033[0m"
echo

+ 9
- 0
Readme.txt 파일 보기

@@ -0,0 +1,9 @@
01.ENV_check.sh
2019/08/04:
* It can depend on who you are to perform Backup/Restore solution
* It can auto selete mysqldump or /opt/lampp/bin/mysqldump
* It can auto selete mysql or /opt/lampp/bin/mysql
* It can select backup destenation mode as below. But you have to install enough QTY of HDDs.
A: OS_HDD only
B: OS_HDD + BAK_Disk_A
C: OS_HDD + BAK_Disk_A + BAK_Disk_B

+ 5
- 0
_LOG/ED8_restore_from_local-mysql.log 파일 보기

@@ -0,0 +1,5 @@
======= 2019/08/06 00:06:58 ==========================
2019/08/06 00:06:58 - Starting restore ED8 mysql from dumped files
1/2: The database named db_ed8_ exist, go next
2/2: Restore mysql failed.


+ 55
- 0
_LOG/ED8backup-Script_ED8.log 파일 보기

@@ -0,0 +1,55 @@
===== 2019/08/05 18:02:39 ===== ./ED8backup-Script_ED8-Auto.sh =====
Pass. Backup file saving folder: /ED/ED8/Backup_file exist, go next.
/ED/ED8/Script_ED8/
/ED/ED8/Script_ED8/ED8backup-mysql-Auto.sh.TMP
/ED/ED8/Script_ED8/_LOG/
/ED/ED8/Script_ED8/_LOG/ED8backup-Script_ED8.log
/ED/ED8/Script_ED8/_LOG/ED8backup-mysql-Auto.log
/ED/ED8/Script_ED8/ED8backup-Script_ED8-Auto.sh
/ED/ED8/Script_ED8/ED8backup-mysql-Auto.sh
/ED/ED8/Script_ED8/ED8backup-mysql-Auto.sh.SRC
/ED/ED8/Script_ED8/ED8restore_from_local-mysql.sh.SRC
/ED/ED8/Script_ED8/Readme.txt
/ED/ED8/Script_ED8/01.ENV_check.sh
/ED/ED8/Script_ED8/ED8restore_from_local-mysql.sh
/ED/ED8/Script_ED8/02.AutoBackup_crontab_check.sh
Pass. tar Script_ED8 file OK.
Pass. Make a copy file to "/ED/ED8/Backup_file". Finished!
===== 2019/08/05 19:17:24 ===== ./ED8backup-Script_ED8-Auto.sh =====
Pass. Backup file saving folder: /ED/ED8/Backup_file exist, go next.
/ED/ED8/Script_ED8/
/ED/ED8/Script_ED8/ED8backup-mysql-Auto.sh.TMP
/ED/ED8/Script_ED8/_LOG/
/ED/ED8/Script_ED8/_LOG/ED8backup-Script_ED8.log
/ED/ED8/Script_ED8/_LOG/ED8backup-mysql-Auto.log
/ED/ED8/Script_ED8/.ED8backup-mysql-Auto.sh.swp
/ED/ED8/Script_ED8/ED8backup-Script_ED8-Auto.sh
/ED/ED8/Script_ED8/ED8backup-mysql-Auto.sh
/ED/ED8/Script_ED8/ED8backup-mysql-Auto.sh.SRC
/ED/ED8/Script_ED8/ED8restore_from_local-mysql.sh.SRC
/ED/ED8/Script_ED8/Readme.txt
/ED/ED8/Script_ED8/01.ENV_check.sh
/ED/ED8/Script_ED8/ED8restore_from_local-mysql.sh
/ED/ED8/Script_ED8/02.AutoBackup_crontab_check.sh
Pass. tar Script_ED8 file OK.
Pass. Make a copy file to "/ED/ED8/Backup_file". Finished!
Fail. Copied to BAK_Disk_A. 
===== 2019/08/05 19:22:11 ===== ./ED8backup-Script_ED8-Auto.sh =====
Pass. Backup file saving folder: /ED/ED8/Backup_file exist, go next.
/ED/ED8/Script_ED8/
/ED/ED8/Script_ED8/ED8backup-mysql-Auto.sh.TMP
/ED/ED8/Script_ED8/_LOG/
/ED/ED8/Script_ED8/_LOG/ED8backup-Script_ED8.log
/ED/ED8/Script_ED8/_LOG/ED8backup-mysql-Auto.log
/ED/ED8/Script_ED8/ED8backup-Script_ED8-Auto.sh
/ED/ED8/Script_ED8/ED8backup-mysql-Auto.sh
/ED/ED8/Script_ED8/ED8backup-mysql-Auto.sh.SRC
/ED/ED8/Script_ED8/.ED8backup-Script_ED8-Auto.sh.swp
/ED/ED8/Script_ED8/ED8restore_from_local-mysql.sh.SRC
/ED/ED8/Script_ED8/Readme.txt
/ED/ED8/Script_ED8/01.ENV_check.sh
/ED/ED8/Script_ED8/ED8restore_from_local-mysql.sh
/ED/ED8/Script_ED8/02.AutoBackup_crontab_check.sh
Pass. tar Script_ED8 file OK.
Pass. Make a copy file to "/ED/ED8/Backup_file". Finished!
Pass. Copied to BAK_Disk_A. 

+ 445
- 0
_LOG/ED8backup-mysql-Auto.log 파일 보기

@@ -0,0 +1,445 @@
===== 2019/08/05 02:18:01 ===== /ED/ED8/Script_ED8/ED8backup-mysql-Auto.sh =====
>> Pass. /home/girl/PW/mysql_ED8.info exist.
>> Warning! There is no folder "_LOG". Next will create a new one.
===== 2019/08/05 02:20:01 ===== /ED/ED8/Script_ED8/ED8backup-mysql-Auto.sh =====
>> Pass. /home/girl/PW/mysql_ED8.info exist.
>> Pass. There is a folder "/ED/ED8/Script_ED8/_LOG". 
>> Pass. Backup file saving folder: /ED/ED8/Backup_file exist, go next.
>> Pass. mysql dump w/ gzip OK. 
>> Pass. Make a copy OK - (/ED/ED8/Backup_file/backup-mysql-ED8-20190805-022001.gz) 
>> Pass. The BAK_Disk_A "/dev/sdb" be detected by lsscsi. 
>> Pass. The BAK_Disk_A mount point exist "/BAK_Disk_A"
>> Pass. The BAK_Disk_A (/dev/sdb) be mounted at "/BAK_Disk_A"
>> Pass. BAK_Disk_A Hostname folder: /BAK_Disk_A/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_A/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_A/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190805-022001.gz) 
>> Pass. The BAK_Disk_B "/dev/sda" be detected by lsscsi. 
>> Pass. The BAK_Disk_B mount point exist "/BAK_Disk_B"
>> Pass. The BAK_Disk_B (/dev/sda) be mounted at "/BAK_Disk_B"
>> Pass. BAK_Disk_B Hostname folder: /BAK_Disk_B/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_B/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_B/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190805-022001.gz) 
===== 2019/08/05 23:18:02 ===== ./ED8backup-mysql-Auto.sh =====
>> Pass. /home/girl/PW/mysql_ED8.info exist.
>> Pass. There is a folder "/ED/ED8/Script_ED8/_LOG". 
>> Pass. Backup file saving folder: /ED/ED8/Backup_file exist, go next.
>> Pass. mysql dump w/ gzip OK. 
>> Pass. Make a copy OK - (/ED/ED8/Backup_file/backup-mysql-ED8-20190805-231801.gz) 
>> Pass. The BAK_Disk_A "/dev/sdb" be detected by lsscsi. 
>> Pass. The BAK_Disk_A mount point exist "/BAK_Disk_A"
>> Pass. The BAK_Disk_A (/dev/sdb) be mounted at "/BAK_Disk_A"
>> Pass. BAK_Disk_A Hostname folder: /BAK_Disk_A/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_A/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_A/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190805-231801.gz) 
>> Pass. The BAK_Disk_B "/dev/sda" be detected by lsscsi. 
>> Pass. The BAK_Disk_B mount point exist "/BAK_Disk_B"
>> Pass. The BAK_Disk_B (/dev/sda) be mounted at "/BAK_Disk_B"
>> Pass. BAK_Disk_B Hostname folder: /BAK_Disk_B/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_B/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_B/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190805-231801.gz) 
===== 2019/08/07 01:01:45 ===== ./ED8backup-mysql-Auto.sh =====
>> Pass. /home/girl/PW/mysql_ED8.info exist.
>> Pass. There is a folder "/ED/ED8/Script_ED8/_LOG". 
>> Pass. Backup file saving folder: /ED/ED8/Backup_file exist, go next.
>> Pass. mysql dump w/ gzip OK. 
>> Pass. Make a copy OK - (/ED/ED8/Backup_file/backup-mysql-ED8-20190807-010145.gz) 
>> Pass. The BAK_Disk_A "/dev/sdb" be detected by lsscsi. 
>> Pass. The BAK_Disk_A mount point exist "/BAK_Disk_A"
>> Pass. The BAK_Disk_A (/dev/sdb) be mounted at "/BAK_Disk_A"
>> Pass. BAK_Disk_A Hostname folder: /BAK_Disk_A/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_A/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_A/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190807-010145.gz) 
>> Pass. The BAK_Disk_B "/dev/sda" be detected by lsscsi. 
>> Pass. The BAK_Disk_B mount point exist "/BAK_Disk_B"
>> Pass. The BAK_Disk_B (/dev/sda) be mounted at "/BAK_Disk_B"
>> Pass. BAK_Disk_B Hostname folder: /BAK_Disk_B/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_B/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_B/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190807-010145.gz) 
===== 2019/08/07 01:28:01 ===== /ED/ED8/Script_ED8/ED8backup-mysql-Auto.sh =====
>> Pass. /home/girl/PW/mysql_ED8.info exist.
>> Pass. There is a folder "/ED/ED8/Script_ED8/_LOG". 
>> Pass. Backup file saving folder: /ED/ED8/Backup_file exist, go next.
>> Pass. mysql dump w/ gzip OK. 
>> Pass. Make a copy OK - (/ED/ED8/Backup_file/backup-mysql-ED8-20190807-012801.gz) 
>> Pass. The BAK_Disk_A "/dev/sdb" be detected by lsscsi. 
>> Pass. The BAK_Disk_A mount point exist "/BAK_Disk_A"
>> Pass. The BAK_Disk_A (/dev/sdb) be mounted at "/BAK_Disk_A"
>> Pass. BAK_Disk_A Hostname folder: /BAK_Disk_A/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_A/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_A/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190807-012801.gz) 
>> Pass. The BAK_Disk_B "/dev/sda" be detected by lsscsi. 
>> Pass. The BAK_Disk_B mount point exist "/BAK_Disk_B"
>> Pass. The BAK_Disk_B (/dev/sda) be mounted at "/BAK_Disk_B"
>> Pass. BAK_Disk_B Hostname folder: /BAK_Disk_B/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_B/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_B/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190807-012801.gz) 
===== 2019/08/07 14:18:43 ===== ./ED8backup-mysql-Auto.sh =====
>> Pass. /home/girl/PW/mysql_ED8.info exist.
>> Pass. There is a folder "/ED/ED8/Script_ED8/_LOG". 
>> Pass. Backup file saving folder: /ED/ED8/Backup_file exist, go next.
>> Pass. mysql dump w/ gzip OK. 
>> Pass. Make a copy OK - (/ED/ED8/Backup_file/backup-mysql-ED8-20190807-141843.gz) 
>> Pass. The BAK_Disk_A "/dev/sdb" be detected by lsscsi. 
>> Pass. The BAK_Disk_A mount point exist "/BAK_Disk_A"
>> Pass. The BAK_Disk_A (/dev/sdb) be mounted at "/BAK_Disk_A"
>> Pass. BAK_Disk_A Hostname folder: /BAK_Disk_A/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_A/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_A/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190807-141843.gz) 
>> Pass. The BAK_Disk_B "/dev/sda" be detected by lsscsi. 
>> Pass. The BAK_Disk_B mount point exist "/BAK_Disk_B"
>> Pass. The BAK_Disk_B (/dev/sda) be mounted at "/BAK_Disk_B"
>> Pass. BAK_Disk_B Hostname folder: /BAK_Disk_B/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_B/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_B/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190807-141843.gz) 
===== 2019/08/07 14:22:39 ===== ./ED8backup-mysql-Auto.sh =====
>> Pass. /home/girl/PW/mysql_ED8.info exist.
>> Pass. There is a folder "/ED/ED8/Script_ED8/_LOG". 
>> Pass. Backup file saving folder: /ED/ED8/Backup_file exist, go next.
>> Pass. mysql dump w/ gzip OK. 
>> Pass. Make a copy OK - (/ED/ED8/Backup_file/backup-mysql-ED8-20190807-142239.gz) 
>> Pass. The BAK_Disk_A "/dev/sdb" be detected by lsscsi. 
>> Pass. The BAK_Disk_A mount point exist "/BAK_Disk_A"
>> Pass. The BAK_Disk_A (/dev/sdb) be mounted at "/BAK_Disk_A"
>> Pass. BAK_Disk_A Hostname folder: /BAK_Disk_A/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_A/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_A/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190807-142239.gz) 
>> Pass. The BAK_Disk_B "/dev/sda" be detected by lsscsi. 
>> Pass. The BAK_Disk_B mount point exist "/BAK_Disk_B"
>> Pass. The BAK_Disk_B (/dev/sda) be mounted at "/BAK_Disk_B"
>> Pass. BAK_Disk_B Hostname folder: /BAK_Disk_B/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_B/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_B/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190807-142239.gz) 
===== 2019/08/07 14:23:21 ===== ./ED8backup-mysql-Auto.sh =====
>> Pass. /home/girl/PW/mysql_ED8.info exist.
>> Pass. There is a folder "/ED/ED8/Script_ED8/_LOG". 
>> Pass. Backup file saving folder: /ED/ED8/Backup_file exist, go next.
>> Pass. mysql dump w/ gzip OK. 
>> Pass. Make a copy OK - (/ED/ED8/Backup_file/backup-mysql-ED8-20190807-142321.gz) 
>> Pass. The BAK_Disk_A "/dev/sdb" be detected by lsscsi. 
>> Pass. The BAK_Disk_A mount point exist "/BAK_Disk_A"
>> Pass. The BAK_Disk_A (/dev/sdb) be mounted at "/BAK_Disk_A"
>> Pass. BAK_Disk_A Hostname folder: /BAK_Disk_A/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_A/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_A/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190807-142321.gz) 
>> Pass. The BAK_Disk_B "/dev/sda" be detected by lsscsi. 
>> Pass. The BAK_Disk_B mount point exist "/BAK_Disk_B"
>> Pass. The BAK_Disk_B (/dev/sda) be mounted at "/BAK_Disk_B"
>> Pass. BAK_Disk_B Hostname folder: /BAK_Disk_B/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_B/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_B/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190807-142321.gz) 
===== 2019/08/07 14:33:36 ===== ./ED8backup-mysql-Auto.sh =====
>> Pass. /home/girl/PW/mysql_ED8.info exist.
>> Pass. There is a folder "/ED/ED8/Script_ED8/_LOG". 
>> Pass. Backup file saving folder: /ED/ED8/Backup_file exist, go next.
>> Pass. mysql dump w/ gzip OK. 
>> Pass. Make a copy OK - (/ED/ED8/Backup_file/backup-mysql-ED8-20190807-143336.gz) 
>> Pass. The BAK_Disk_A "/dev/sdb" be detected by lsscsi. 
>> Pass. The BAK_Disk_A mount point exist "/BAK_Disk_A"
>> Pass. The BAK_Disk_A (/dev/sdb) be mounted at "/BAK_Disk_A"
>> Pass. BAK_Disk_A Hostname folder: /BAK_Disk_A/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_A/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_A/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190807-143336.gz) 
>> Pass. The BAK_Disk_B "/dev/sda" be detected by lsscsi. 
>> Pass. The BAK_Disk_B mount point exist "/BAK_Disk_B"
>> Pass. The BAK_Disk_B (/dev/sda) be mounted at "/BAK_Disk_B"
>> Pass. BAK_Disk_B Hostname folder: /BAK_Disk_B/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_B/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_B/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190807-143336.gz) 
===== 2019/08/07 14:35:49 ===== ./ED8backup-mysql-Auto.sh =====
>> Pass. /home/girl/PW/mysql_ED8.info exist.
>> Pass. There is a folder "/ED/ED8/Script_ED8/_LOG". 
>> Pass. Backup file saving folder: /ED/ED8/Backup_file exist, go next.
>> Pass. mysql dump w/ gzip OK. 
>> Pass. Make a copy OK - (/ED/ED8/Backup_file/backup-mysql-ED8-20190807-143549.gz) 
>> Pass. The BAK_Disk_A "/dev/sdb" be detected by lsscsi. 
>> Pass. The BAK_Disk_A mount point exist "/BAK_Disk_A"
>> Pass. The BAK_Disk_A (/dev/sdb) be mounted at "/BAK_Disk_A"
>> Pass. BAK_Disk_A Hostname folder: /BAK_Disk_A/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_A/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_A/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190807-143549.gz) 
>> Pass. The BAK_Disk_B "/dev/sda" be detected by lsscsi. 
>> Pass. The BAK_Disk_B mount point exist "/BAK_Disk_B"
>> Pass. The BAK_Disk_B (/dev/sda) be mounted at "/BAK_Disk_B"
>> Pass. BAK_Disk_B Hostname folder: /BAK_Disk_B/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_B/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_B/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190807-143549.gz) 
===== 2019/08/07 14:40:30 ===== ./ED8backup-mysql-Auto.sh =====
>> Pass. /home/girl/PW/mysql_ED8.info exist.
>> Pass. There is a folder "/ED/ED8/Script_ED8/_LOG". 
>> Pass. Backup file saving folder: /ED/ED8/Backup_file exist, go next.
>> Pass. mysql dump w/ gzip OK. 
>> Pass. Make a copy OK - (/ED/ED8/Backup_file/backup-mysql-ED8-20190807-144029.gz) 
>> Pass. The BAK_Disk_A "/dev/sdb" be detected by lsscsi. 
>> Pass. The BAK_Disk_A mount point exist "/BAK_Disk_A"
>> Pass. The BAK_Disk_A (/dev/sdb) be mounted at "/BAK_Disk_A"
>> Pass. BAK_Disk_A Hostname folder: /BAK_Disk_A/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_A/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_A/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190807-144029.gz) 
>> Pass. The BAK_Disk_B "/dev/sda" be detected by lsscsi. 
>> Pass. The BAK_Disk_B mount point exist "/BAK_Disk_B"
>> Pass. The BAK_Disk_B (/dev/sda) be mounted at "/BAK_Disk_B"
>> Pass. BAK_Disk_B Hostname folder: /BAK_Disk_B/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_B/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_B/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190807-144029.gz) 
===== 2019/08/07 14:40:48 ===== ./ED8backup-mysql-Auto.sh =====
>> Pass. /home/girl/PW/mysql_ED8.info exist.
>> Pass. There is a folder "/ED/ED8/Script_ED8/_LOG". 
>> Pass. Backup file saving folder: /ED/ED8/Backup_file exist, go next.
>> Pass. mysql dump w/ gzip OK. 
>> Pass. Make a copy OK - (/ED/ED8/Backup_file/backup-mysql-ED8-20190807-144048.gz) 
>> Pass. The BAK_Disk_A "/dev/sdb" be detected by lsscsi. 
>> Pass. The BAK_Disk_A mount point exist "/BAK_Disk_A"
>> Pass. The BAK_Disk_A (/dev/sdb) be mounted at "/BAK_Disk_A"
>> Pass. BAK_Disk_A Hostname folder: /BAK_Disk_A/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_A/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_A/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190807-144048.gz) 
>> Pass. The BAK_Disk_B "/dev/sda" be detected by lsscsi. 
>> Pass. The BAK_Disk_B mount point exist "/BAK_Disk_B"
>> Pass. The BAK_Disk_B (/dev/sda) be mounted at "/BAK_Disk_B"
>> Pass. BAK_Disk_B Hostname folder: /BAK_Disk_B/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_B/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_B/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190807-144048.gz) 
===== 2019/08/07 14:44:07 ===== ./ED8backup-mysql-Auto.sh =====
>> Pass. /home/girl/PW/mysql_ED8.info exist.
>> Pass. There is a folder "/ED/ED8/Script_ED8/_LOG". 
>> Pass. Backup file saving folder: /ED/ED8/Backup_file exist, go next.
>> Pass. mysql dump w/ gzip OK. 
>> Pass. Make a copy OK - (/ED/ED8/Backup_file/backup-mysql-ED8-20190807-144407.gz) 
>> Pass. The BAK_Disk_A "/dev/sdb" be detected by lsscsi. 
>> Pass. The BAK_Disk_A mount point exist "/BAK_Disk_A"
>> Pass. The BAK_Disk_A (/dev/sdb) be mounted at "/BAK_Disk_A"
>> Pass. BAK_Disk_A Hostname folder: /BAK_Disk_A/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_A/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_A/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190807-144407.gz) 
>> Pass. The BAK_Disk_B "/dev/sda" be detected by lsscsi. 
>> Pass. The BAK_Disk_B mount point exist "/BAK_Disk_B"
>> Pass. The BAK_Disk_B (/dev/sda) be mounted at "/BAK_Disk_B"
>> Pass. BAK_Disk_B Hostname folder: /BAK_Disk_B/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_B/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_B/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190807-144407.gz) 
===== 2019/08/07 14:44:38 ===== ./ED8backup-mysql-Auto.sh =====
>> Pass. /home/girl/PW/mysql_ED8.info exist.
>> Pass. There is a folder "/ED/ED8/Script_ED8/_LOG". 
>> Pass. Backup file saving folder: /ED/ED8/Backup_file exist, go next.
===========================================================================
>> Pass. mysql dump w/ gzip OK. 
===========================================================================
>> Pass. Make a copy OK - (/ED/ED8/Backup_file/backup-mysql-ED8-20190807-144437.gz) 
>> Pass. The BAK_Disk_A "/dev/sdb" be detected by lsscsi. 
>> Pass. The BAK_Disk_A mount point exist "/BAK_Disk_A"
>> Pass. The BAK_Disk_A (/dev/sdb) be mounted at "/BAK_Disk_A"
>> Pass. BAK_Disk_A Hostname folder: /BAK_Disk_A/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_A/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_A/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190807-144437.gz) 
>> Pass. The BAK_Disk_B "/dev/sda" be detected by lsscsi. 
>> Pass. The BAK_Disk_B mount point exist "/BAK_Disk_B"
>> Pass. The BAK_Disk_B (/dev/sda) be mounted at "/BAK_Disk_B"
>> Pass. BAK_Disk_B Hostname folder: /BAK_Disk_B/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_B/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_B/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190807-144437.gz) 
===== 2019/08/07 14:46:41 ===== ./ED8backup-mysql-Auto.sh =====
>> Pass. /home/girl/PW/mysql_ED8.info exist.
>> Pass. There is a folder "/ED/ED8/Script_ED8/_LOG". 
>> Pass. Backup file saving folder: /ED/ED8/Backup_file exist, go next.
===========================================================================
>> Pass. mysql dump w/ gzip OK. 
===========================================================================
>> Pass. Make a copy OK - (/ED/ED8/Backup_file/backup-mysql-ED8-20190807-144641.gz) 
>> Pass. The BAK_Disk_A "/dev/sdb" be detected by lsscsi. 
>> Pass. The BAK_Disk_A mount point exist "/BAK_Disk_A"
>> Pass. The BAK_Disk_A (/dev/sdb) be mounted at "/BAK_Disk_A"
>> Pass. BAK_Disk_A Hostname folder: /BAK_Disk_A/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_A/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_A/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190807-144641.gz) 
>> Pass. The BAK_Disk_B "/dev/sda" be detected by lsscsi. 
>> Pass. The BAK_Disk_B mount point exist "/BAK_Disk_B"
>> Pass. The BAK_Disk_B (/dev/sda) be mounted at "/BAK_Disk_B"
>> Pass. BAK_Disk_B Hostname folder: /BAK_Disk_B/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_B/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_B/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190807-144641.gz) 
===== 2019/08/07 14:48:56 ===== ./ED8backup-mysql-Auto.sh =====
>> Pass. /home/girl/PW/mysql_ED8.info exist.
>> Pass. There is a folder "/ED/ED8/Script_ED8/_LOG". 
>> Pass. Backup file saving folder: /ED/ED8/Backup_file exist, go next.
===========================================================================
 Important! Please check below messages for making sure mysqldump be performed exactly. 
>> Pass. mysql dump w/ gzip OK. 
===========================================================================
Starting make a copy with timastamp filename...
>> Pass. Make a copy OK - (/ED/ED8/Backup_file/backup-mysql-ED8-20190807-144855.gz) 
>> Pass. The BAK_Disk_A "/dev/sdb" be detected by lsscsi. 
>> Pass. The BAK_Disk_A mount point exist "/BAK_Disk_A"
>> Pass. The BAK_Disk_A (/dev/sdb) be mounted at "/BAK_Disk_A"
>> Pass. BAK_Disk_A Hostname folder: /BAK_Disk_A/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_A/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_A/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190807-144855.gz) 
>> Pass. The BAK_Disk_B "/dev/sda" be detected by lsscsi. 
>> Pass. The BAK_Disk_B mount point exist "/BAK_Disk_B"
>> Pass. The BAK_Disk_B (/dev/sda) be mounted at "/BAK_Disk_B"
>> Pass. BAK_Disk_B Hostname folder: /BAK_Disk_B/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_B/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_B/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190807-144855.gz) 
===== 2019/08/07 14:49:52 ===== ./ED8backup-mysql-Auto.sh =====
>> Pass. /home/girl/PW/mysql_ED8.info exist.
>> Pass. There is a folder "/ED/ED8/Script_ED8/_LOG". 
>> Pass. Backup file saving folder: /ED/ED8/Backup_file exist, go next.
===================================================================================
 Important! Please check below messages for making sure mysqldump be performed exactly. 
>> Pass. mysql dump w/ gzip OK. 
===================================================================================
Starting make a copy with timastamp filename...
>> Pass. Make a copy OK - (/ED/ED8/Backup_file/backup-mysql-ED8-20190807-144952.gz) 
>> Pass. The BAK_Disk_A "/dev/sdb" be detected by lsscsi. 
>> Pass. The BAK_Disk_A mount point exist "/BAK_Disk_A"
>> Pass. The BAK_Disk_A (/dev/sdb) be mounted at "/BAK_Disk_A"
>> Pass. BAK_Disk_A Hostname folder: /BAK_Disk_A/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_A/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_A/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190807-144952.gz) 
>> Pass. The BAK_Disk_B "/dev/sda" be detected by lsscsi. 
>> Pass. The BAK_Disk_B mount point exist "/BAK_Disk_B"
>> Pass. The BAK_Disk_B (/dev/sda) be mounted at "/BAK_Disk_B"
>> Pass. BAK_Disk_B Hostname folder: /BAK_Disk_B/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_B/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_B/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190807-144952.gz) 
===== 2019/08/07 14:51:19 ===== ./ED8backup-mysql-Auto.sh =====
>> Pass. /home/girl/PW/mysql_ED8.info exist.
>> Pass. There is a folder "/ED/ED8/Script_ED8/_LOG". 
>> Pass. Backup file saving folder: /ED/ED8/Backup_file exist, go next.
===================================================================================
 Important! Please check below messages for making sure mysqldump be performed exactly. 
>> Pass. mysql dump w/ gzip OK. 
===================================================================================
Starting make a copy with timastamp filename...
>> Pass. Make a copy OK - (/ED/ED8/Backup_file/backup-mysql-ED8-20190807-145119.gz) 
>> Pass. The BAK_Disk_A "/dev/sdb" be detected by lsscsi. 
>> Pass. The BAK_Disk_A mount point exist "/BAK_Disk_A"
>> Pass. The BAK_Disk_A (/dev/sdb) be mounted at "/BAK_Disk_A"
>> Pass. BAK_Disk_A Hostname folder: /BAK_Disk_A/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_A/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_A/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190807-145119.gz) 
>> Pass. The BAK_Disk_B "/dev/sda" be detected by lsscsi. 
>> Pass. The BAK_Disk_B mount point exist "/BAK_Disk_B"
>> Pass. The BAK_Disk_B (/dev/sda) be mounted at "/BAK_Disk_B"
>> Pass. BAK_Disk_B Hostname folder: /BAK_Disk_B/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_B/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_B/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190807-145119.gz) 
===== 2019/08/07 14:51:44 ===== ./ED8backup-mysql-Auto.sh =====
>> Pass. /home/girl/PW/mysql_ED8.info exist.
>> Pass. There is a folder "/ED/ED8/Script_ED8/_LOG". 
>> Pass. Backup file saving folder: /ED/ED8/Backup_file exist, go next.
==========================================================================================
 Important! Please check below messages for making sure mysqldump be performed exactly. 
>> Pass. mysql dump w/ gzip OK. 
==========================================================================================
Starting make a copy with timastamp filename...
>> Pass. Make a copy OK - (/ED/ED8/Backup_file/backup-mysql-ED8-20190807-145144.gz) 
>> Pass. The BAK_Disk_A "/dev/sdb" be detected by lsscsi. 
>> Pass. The BAK_Disk_A mount point exist "/BAK_Disk_A"
>> Pass. The BAK_Disk_A (/dev/sdb) be mounted at "/BAK_Disk_A"
>> Pass. BAK_Disk_A Hostname folder: /BAK_Disk_A/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_A/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_A/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190807-145144.gz) 
>> Pass. The BAK_Disk_B "/dev/sda" be detected by lsscsi. 
>> Pass. The BAK_Disk_B mount point exist "/BAK_Disk_B"
>> Pass. The BAK_Disk_B (/dev/sda) be mounted at "/BAK_Disk_B"
>> Pass. BAK_Disk_B Hostname folder: /BAK_Disk_B/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_B/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_B/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190807-145144.gz) 
===== 2019/08/07 15:04:35 ===== ./ED8backup-mysql-Auto.sh =====
>> Pass. /home/girl/PW/mysql_ED8.info exist.
>> Pass. There is a folder "/ED/ED8/Script_ED8/_LOG". 
>> Pass. Backup file saving folder: /ED/ED8/Backup_file exist, go next.
==========================================================================================
 Important! Please check below messages for making sure mysqldump be performed exactly. 
>> Pass. mysql dump w/ gzip OK. 
==========================================================================================
Starting make a copy with timastamp filename...
>> Pass. Make a copy OK - (/ED/ED8/Backup_file/backup-mysql-ED8-20190807-150435.gz) 
>> Pass. The BAK_Disk_A "/dev/sdb" be detected by lsscsi. 
>> Pass. The BAK_Disk_A mount point exist "/BAK_Disk_A"
>> Pass. The BAK_Disk_A (/dev/sdb) be mounted at "/BAK_Disk_A"
>> Pass. BAK_Disk_A Hostname folder: /BAK_Disk_A/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_A/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_A/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190807-150435.gz) 
>> Pass. The BAK_Disk_B "/dev/sda" be detected by lsscsi. 
>> Pass. The BAK_Disk_B mount point exist "/BAK_Disk_B"
>> Pass. The BAK_Disk_B (/dev/sda) be mounted at "/BAK_Disk_B"
>> Pass. BAK_Disk_B Hostname folder: /BAK_Disk_B/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_B/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_B/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190807-150435.gz) 
===== 2019/08/07 15:05:28 ===== ./ED8backup-mysql-Auto.sh =====
>> Pass. /home/girl/PW/mysql_ED8.info exist.
>> Pass. There is a folder "/ED/ED8/Script_ED8/_LOG". 
>> Pass. Backup file saving folder: /ED/ED8/Backup_file exist, go next.
==========================================================================================
 Important! Please check below messages for making sure mysqldump be performed exactly. 
>> Pass. mysql dump w/ gzip OK. 
==========================================================================================
==========================================================================================
Starting make a copy with timastamp filename...
>> Pass. Make a copy OK - (/ED/ED8/Backup_file/backup-mysql-ED8-20190807-150528.gz) 
>> Pass. The BAK_Disk_A "/dev/sdb" be detected by lsscsi. 
>> Pass. The BAK_Disk_A mount point exist "/BAK_Disk_A"
>> Pass. The BAK_Disk_A (/dev/sdb) be mounted at "/BAK_Disk_A"
>> Pass. BAK_Disk_A Hostname folder: /BAK_Disk_A/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_A/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_A/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190807-150528.gz) 
>> Pass. The BAK_Disk_B "/dev/sda" be detected by lsscsi. 
>> Pass. The BAK_Disk_B mount point exist "/BAK_Disk_B"
>> Pass. The BAK_Disk_B (/dev/sda) be mounted at "/BAK_Disk_B"
>> Pass. BAK_Disk_B Hostname folder: /BAK_Disk_B/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_B/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_B/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190807-150528.gz) 
===== 2019/08/07 15:06:24 ===== ./ED8backup-mysql-Auto.sh =====
>> Pass. /home/girl/PW/mysql_ED8.info exist.
>> Pass. There is a folder "/ED/ED8/Script_ED8/_LOG". 
>> Pass. Backup file saving folder: /ED/ED8/Backup_file exist, go next.
==========================================================================================
 Important! Please check below messages for making sure mysqldump be performed exactly. 
>> Pass. mysql dump w/ gzip OK. 
==========================================================================================
==========================================================================================
Starting make a copy with timastamp filename...
>> Pass. Make a copy OK - (/ED/ED8/Backup_file/backup-mysql-ED8-20190807-150624.gz) 
>> Pass. The BAK_Disk_A "/dev/sdb" be detected by lsscsi. 
>> Pass. The BAK_Disk_A mount point exist "/BAK_Disk_A"
>> Pass. The BAK_Disk_A (/dev/sdb) be mounted at "/BAK_Disk_A"
>> Pass. BAK_Disk_A Hostname folder: /BAK_Disk_A/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_A/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_A/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190807-150624.gz) 
>> Pass. The BAK_Disk_B "/dev/sda" be detected by lsscsi. 
>> Pass. The BAK_Disk_B mount point exist "/BAK_Disk_B"
>> Pass. The BAK_Disk_B (/dev/sda) be mounted at "/BAK_Disk_B"
>> Pass. BAK_Disk_B Hostname folder: /BAK_Disk_B/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_B/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_B/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190807-150624.gz) 
===== 2019/08/07 15:27:33 ===== ./ED8backup-mysql-Auto.sh.SRC =====
>> Pass. /home/girl/PW/mysql_ED8.info exist.
>> Pass. There is a folder "/ED/ED8/Script_ED8/_LOG". 
>> Pass. Backup file saving folder: /ED/ED8/Backup_file exist, go next.
===========================================================================
>> Pass. mysql dump w/ gzip OK. 
===========================================================================
>> Pass. Make a copy OK - (/ED/ED8/Backup_file/backup-mysql-ED8-20190807-152732.gz) 
===== 2019/08/07 16:25:11 ===== ./ED8backup-mysql-Auto.sh =====
>> Pass. /home/girl/PW/mysql_ED8.info exist.
>> Pass. There is a folder "/ED/ED8/Script_ED8/_LOG". 
>> Pass. Backup file saving folder: /ED/ED8/Backup_file exist, go next.
==========================================================================================
 Important! Please check below messages for making sure mysqldump be performed exactly. 
>> Pass. mysql dump w/ gzip OK. 
==========================================================================================
Starting make a copy with timastamp filename...
>> Pass. Make a copy OK - (/ED/ED8/Backup_file/backup-mysql-ED8-20190807-162511.gz) 
>> Pass. The BAK_Disk_A "/dev/sdb" be detected by lsscsi. 
>> Pass. The BAK_Disk_A mount point exist "/BAK_Disk_A"
>> Pass. The BAK_Disk_A (/dev/sdb) be mounted at "/BAK_Disk_A"
>> Pass. BAK_Disk_A Hostname folder: /BAK_Disk_A/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_A/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_A/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190807-162511.gz) 
>> Pass. The BAK_Disk_B "/dev/sda" be detected by lsscsi. 
>> Pass. The BAK_Disk_B mount point exist "/BAK_Disk_B"
>> Pass. The BAK_Disk_B (/dev/sda) be mounted at "/BAK_Disk_B"
>> Pass. BAK_Disk_B Hostname folder: /BAK_Disk_B/girl-Home exist, go next.
>> Pass. BAK_Disk's Backup file saving folder: /BAK_Disk_B/girl-Home/ED8/Backup_file exist, go next.
>> Pass. Make a copy OK - (/BAK_Disk_B/girl-Home/ED8/Backup_file/backup-mysql-ED8-20190807-162511.gz) 

+ 20
- 0
_LOG/ED8restore_from_local-mysql.log 파일 보기

@@ -0,0 +1,20 @@
======= 2019/08/06 00:08:11 ==========================
2019/08/06 00:08:11 - Starting restore ED8 mysql from dumped files
1/2: The database named db_ed8_ exist, go next
2/2: Restored mysql. Finished

======= 2019/08/07 01:13:45 ==========================
2019/08/07 01:13:45 - Starting restore ED8 mysql from dumped files
1/2: The database named db_ed8_ exist, go next
2/2: Restored mysql. Finished

======= 2019/08/07 01:17:03 ==========================
2019/08/07 01:17:03 - Starting restore ED8 mysql from dumped files
1/2: The database named db_ed8_ exist, go next
2/2: Restored mysql. Finished

======= 2019/08/07 16:25:37 ==========================
2019/08/07 16:25:37 - Starting restore ED8 mysql from dumped files
1/2: The database named db_joe_ exist, go next
2/2: Restore mysql failed.


Loading…
취소
저장