Quellcode durchsuchen

2019/08/11 23:26:58

master
Gitea vor 6 Jahren
Ursprung
Commit
2b7f7a2116

+ 62
- 2
01.ENV_check.sh Datei anzeigen

@@ -5,6 +5,15 @@ 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
Script_SRC_Script_ED8=ED8backup-Script_ED8-Auto.sh.SRC
Script_TMP_Script_ED8=ED8backup-Script_ED8-Auto.sh.TMP
Script_REAL_Script_ED8=ED8backup-Script_ED8-Auto.sh
Script_SRC_Source_Files_ED8=ED8backup-Source_Files-Auto.sh.SRC
Script_TMP_Source_Files_ED8=ED8backup-Source_Files-Auto.sh.TMP
Script_REAL_Source_Files_ED8=ED8backup-Source_Files-Auto.sh
Script_SRC_Remote_Backup=ED8Remote_backup.sh.SRC
Script_TMP_Remote_Backup=ED8Remote_backup.sh.TMP
Script_REAL_Remote_Backup=ED8Remote_backup.sh

USER=`whoami`
PWFile="/home/$USER/PW/mysql_ED8.info"
@@ -22,6 +31,9 @@ CHK_QTY=9

cp $Script_SRC_BAK $Script_TMP_BAK
cp $Script_SRC_Restore $Script_TMP_Restore
cp $Script_SRC_Script_ED8 $Script_TMP_Script_ED8
cp $Script_SRC_Source_Files_ED8 $Script_TMP_Source_Files_ED8
cp $Script_SRC_Remote_Backup $Script_TMP_Remote_Backup

echo -e -n "You are \033[44;37m$USER\033[0m. Is it correct? (y|n) "
read yn
@@ -94,6 +106,10 @@ SEL_BAK_Mode (){
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

sed -i 's/#CP_TO_BAK_Disk_A/CP_TO_BAK_Disk_A/g' $Script_TMP_Script_ED8
sed -i 's/#CP_TO_BAK_Disk_A/CP_TO_BAK_Disk_A/g' $Script_TMP_Source_Files_ED8

echo -e " >> Set it done. "
echo
elif [[ $MODE == "C" ]]; then
@@ -125,6 +141,10 @@ SEL_BAK_Mode (){
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

sed -i 's/#CP_TO_BAK_Disk_A/CP_TO_BAK_Disk_A/g' $Script_TMP_Script_ED8
sed -i 's/#CP_TO_BAK_Disk_A/CP_TO_BAK_Disk_A/g' $Script_TMP_Source_Files_ED8

echo -e " >> Set it done. "
echo

@@ -150,6 +170,10 @@ SEL_BAK_Mode (){
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

sed -i 's/#CP_TO_BAK_Disk_B/CP_TO_BAK_Disk_B/g' $Script_TMP_Script_ED8
sed -i 's/#CP_TO_BAK_Disk_B/CP_TO_BAK_Disk_B/g' $Script_TMP_Source_Files_ED8

echo -e " >> Set it done. "
echo
else
@@ -166,8 +190,8 @@ CHK_PWFile (){
echo
echo -e "$PWFile Content example: "
echo -e "Database_Name: db_ed8_"
echo -e "ID: root"
echo -e "Password: +039*******"
echo -e "ID: ed"
echo -e "Password: edat****"
echo
exit
else
@@ -267,6 +291,7 @@ CHK_UTY_3 (){
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
@@ -284,6 +309,7 @@ CHK_UTY_4 (){
fi
fi
}

CHK_UTY_5 (){
man $UTY_5 > /dev/null 2>&1
if [[ $? == 0 ]]; then
@@ -302,6 +328,34 @@ CHK_UTY_5 (){
fi
}

SEL_REMOTE_BAK (){
echo -e "\033[32mThere two remote backup plan you can use.\033[0m (\033[35mPLAN#X\033[0m and \033[36mPLAN#Y\033[0m)"
echo -e -n "\033[33m1. Do you want to enable \033[35mPlan#X\033[0m? (y|n) "
read yn
if [[ $yn == y ]]; then
echo -e " Your input is y. Enabling the PLAN#X..."
sed -i 's/#MKDIR_REMOTE_BAK_Folder_BAK_Disk_X/MKDIR_REMOTE_BAK_Folder_BAK_Disk_X/g' $Script_TMP_Remote_Backup
sed -i 's/#SCP_TO_BAK_Disk_X/SCP_TO_BAK_Disk_X/g' $Script_TMP_Remote_Backup
elif [[ $yn == n ]]; then
echo -e " Your input is n. Disabling the PLAN#Y..."
else
echo -e " Wrong inout($yn). Exit"
fi

echo -e -n "\033[33m2. Do you want to enable \033[36mPlan#Y\033[0m? (y|n) "
read yn
if [[ $yn == y ]]; then
echo -e " Your input is y. Enabling the PLAN#Y..."
sed -i 's/#MKDIR_REMOTE_BAK_Folder_BAK_Disk_Y/MKDIR_REMOTE_BAK_Folder_BAK_Disk_Y/g' $Script_TMP_Remote_Backup
sed -i 's/#SCP_TO_BAK_Disk_Y/SCP_TO_BAK_Disk_Y/g' $Script_TMP_Remote_Backup
elif [[ $yn == n ]]; then
echo -e " Your input is n. Disabling the PLAN#Y..."
else
echo -e " Wrong inout($yn). Exit"
fi
}


SEL_BAK_Mode
echo
echo
@@ -315,9 +369,15 @@ CHK_UTY_2
CHK_UTY_3
CHK_UTY_4
CHK_UTY_5
echo
SEL_REMOTE_BAK

cp $Script_TMP_BAK $Script_REAL_BAK
cp $Script_TMP_Restore $Script_REAL_Restore
cp $Script_TMP_Script_ED8 $Script_REAL_Script_ED8
cp $Script_TMP_Source_Files_ED8 $Script_REAL_Source_Files_ED8
cp $Script_TMP_Remote_Backup $Script_REAL_Remote_Backup
rm -rf $Script_TMP_BAK $Script_TMP_Restore $Script_TMP_Script_ED8 $Script_TMP_Source_Files_ED8 $Script_TMP_Remote_Backup

echo
echo

+ 29
- 5
02.AutoBackup_crontab_check.sh Datei anzeigen

@@ -2,6 +2,7 @@
Service1=/ED/ED8/Script_ED8/ED8backup-mysql-Auto.sh
Service2=/ED/ED8/Script_ED8/ED8backup-Script_ED8-Auto.sh
Service3=/ED/ED8/Script_ED8/ED8backup-Source_Files-Auto.sh
Service4=/ED/ED8/Script_ED8/ED8Remote_backup.sh

WHO=`whoami`

@@ -13,7 +14,7 @@ if [[ $? == 0 ]]; then
if [[ $? != 0 ]]; then
echo -e "\033[33mPass. $Service1 was set active. \033[0m"
else
echo -e "\033[41;37mFail. $Service1 was appended, but not be set as executing. \033[0m"
echo -e "\033[45;37mWarning! $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[33m#// Create backup file every 2 days at 01:08\033[0m"
echo -e "\033[33m8 1 */2 * * $Service1\033[0m"
@@ -25,6 +26,7 @@ else
echo -e "\033[33m#// Create backup file every 2 days at 01:08\033[0m"
echo -e "\033[33m8 1 */2 * * $Service1\033[0m"
fi
echo

crontab -u $WHO -l | grep "$Service2" > /dev/null 2>&1
if [[ $? == 0 ]]; then
@@ -32,7 +34,7 @@ if [[ $? == 0 ]]; then
if [[ $? != 0 ]]; then
echo -e "\033[33mPass. $Service2 was set active. \033[0m"
else
echo -e "\033[41;37mFail. $Service2 was appended, but not be set as executing. \033[0m"
echo -e "\033[45;37mWarning! $Service2 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[33m#// Create backup file every first day of month at 01:06"
echo -e "\033[33m6 1 1 * * $Service2\033[0m"
@@ -44,6 +46,7 @@ else
echo -e "\033[33m#// Create backup file every first day of month at 01:06"
echo -e "\033[33m6 1 1 * * $Service2\033[0m"
fi
echo

crontab -u $WHO -l | grep "$Service3" > /dev/null 2>&1
if [[ $? == 0 ]]; then
@@ -51,18 +54,39 @@ if [[ $? == 0 ]]; then
if [[ $? != 0 ]]; then
echo -e "\033[33mPass. $Service3 was set active. \033[0m"
else
echo -e "\033[41;37mFail. $Service3 was appended, but not be set as executing. \033[0m"
echo -e "\033[45;37mWarning! $Service3 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[33m#// Create backup file every first day of month at 01:00"
echo -e "\033[33m0 1 1 * * $Service3\033[0m"
echo -e "\033[33m0 1 1 * * $Service3\033[0m"

fi
else
echo -e "\033[41;37mFail. $Service3 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[33m#// Create backup file every first day of month at 01:00"
echo -e "\033[33m0 1 1 * * $Service3\033[0m"
echo -e "\033[33m0 1 1 * * $Service3\033[0m"
fi
echo

crontab -u $WHO -l | grep "$Service4" > /dev/null 2>&1
if [[ $? == 0 ]]; then
crontab -u $WHO -l | grep "$Service4" | cut -c 1-8 | grep "#" > /dev/null 2>&1
if [[ $? != 0 ]]; then
echo -e "\033[33mPass. $Service4 was set active. \033[0m"
else
echo -e "\033[45;37mWarning! $Service4 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[33m#// Create backup file every Monday 06:00"
echo -e "\033[33m0 6 * * 1 $Service4\033[0m"

fi
else
echo -e "\033[41;37mFail. $Service4 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[33m#// Create backup file every Monday 06:00"
echo -e "\033[33m0 6 * * 1 $Service4\033[0m"
fi
echo

echo


+ 223
- 0
ED8Remote_backup.sh Datei anzeigen

@@ -0,0 +1,223 @@
#!/bin/bash
if [ "$#" -ne 2 ]; then
echo
echo -e "######################################################################"
echo -e "######\033[41;37m Wrong paraments input, please refer below usage info !!! \033[0m######"
echo -e "######################################################################"
echo
echo -e "Usage: \033[44;37m./<cmd.sh> <Remote ssh ID> <Remote ssh IP>\033[0m"
echo -e "Example\t: \033[45;37m$0 ed 127.0.0.1\033[0m"
echo; exit 1
fi

BAK_Project=ED8
WHO=`whoami`
HOSTNAME=`hostnamectl | grep "Static hostname" | awk '{print $NF}'`
TS=`date +"%Y%m%d-%H%M%S"`

# Host Local Backup info setup
WORK_Folder=/ED/$BAK_Project/Script_$BAK_Project
Source_BAK_Folder=/ED/$BAK_Project/Backup_file
BAK_1=$Source_BAK_Folder/backup-mysql-$BAK_Project.gz
BAK_2=$Source_BAK_Folder/Script_$BAK_Project.tar
BAK_3=$Source_BAK_Folder/Source_Files_$BAK_Project.tar

# Remote ssh Backup info setup
PW_File=/home/$WHO/PW/Remote_ssh.info
ID=$1
IP=$2
Remote_BAK_Folder_BAK_Disk_X=/BAK_Disk_A/$HOSTNAME/$BAK_Project/Backup_file
Remote_BAK_Folder_BAK_Disk_Y=/BAK_Disk_B/$HOSTNAME/$BAK_Project/Backup_file
REMOTE_X_BAK_1=$Remote_BAK_Folder_BAK_Disk_X/backup-mysql-$BAK_Project-$TS.gz
REMOTE_X_BAK_2=$Remote_BAK_Folder_BAK_Disk_X/Script_$BAK_Project-$TS.tar
REMOTE_X_BAK_3=$Remote_BAK_Folder_BAK_Disk_X/Source_Files_$BAK_Project-$TS.tar
REMOTE_Y_BAK_1=$Remote_BAK_Folder_BAK_Disk_Y/backup-mysql-$BAK_Project-$TS.gz
REMOTE_Y_BAK_2=$Remote_BAK_Folder_BAK_Disk_Y/Script_$BAK_Project-$TS.tar
REMOTE_Y_BAK_3=$Remote_BAK_Folder_BAK_Disk_Y/Source_Files_$BAK_Project-$TS.tar


##### Func
CHK_WORK_Folder (){
echo -e "\033[32mCheck Work Folder ($WORK_Folder) \033[0m"
ls $WORK_Folder > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " \033[34mPass. \033[0m"
else
echo -e " \033[31mFail. Exit.\033[0m"
echo
exit
fi
}

CHK_SRC_BAK_Folder (){
echo -e "\033[32mCheck local Backup source folder ($Source_BAK_Folder) \033[0m"
ls $Source_BAK_Folder > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " \033[34mPass. \033[0m"
else
echo -e " \033[31mFail. Exit.\033[0m"
echo
exit
fi
}

CHK_PW_File (){
echo -e "\033[32mCheck PW file ($PW_File) \033[0m"
ls $PW_File > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " \033[34mPass. \033[0m"
SSH_ID=`cat $PW_File | grep ID | awk '{print $NF}'`
if [[ $SSH_ID != "" ]]; then
echo -e " - \033[34mSSH ID: Good \033[0m"
else
echo -e " - \033[31mSSH ID: Bad. ID is empty\033[0m"
fi
SSH_PW=`cat $PW_File | grep PW | awk '{print $NF}'`
if [[ $SSH_PW != "" ]]; then
echo -e " - \033[34mSSH PW: Good \033[0m"
else
echo -e " - \033[31mSSH PW: Bad. ID is empty\033[0m"
fi
else
echo -e " \033[31mFail. There is no PW file ($PW_File). Please make a new one. Exit. \033[0m"
echo -e " Example of $PW_File: "
echo -e " ID xxxx"
echo -e " PW zzzzzzzz"
echo
exit
fi
}

CHK_REMOTE_IP_AVA (){
echo -e "\033[32mCheck IP ($IP) availiable - ping ($IP) \033[0m"
ping -c1 $IP > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " \033[34mPass. \033[0m"
else
echo -e " \033[31mFail. There is no ping in IP ($IP). Exit \033[0m"
echo
exit
fi
}

CHK_BAK1 (){
echo -e "\033[32mCheck local Backup file status ($BAK_1) \033[0m"
ls $BAK_1 > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " \033[34mPass. \033[0m"
else
echo -e " \033[31mFail. Exit.\033[0m"
echo
exit
fi
}

CHK_BAK2 (){
echo -e "\033[32mCheck local Backup file status ($BAK_2) \033[0m"
ls $BAK_2 > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " \033[34mPass. \033[0m"
else
echo -e " \033[31mFail. Exit.\033[0m"
echo
exit
fi
}

CHK_BAK3 (){
echo -e "\033[32mCheck local Backup file status ($BAK_3) \033[0m"
ls $BAK_2 > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " \033[34mPass. \033[0m"
else
echo -e " \033[31mFail. Exit.\033[0m"
echo
exit
fi
}

MKDIR_REMOTE_BAK_Folder_BAK_Disk_X (){
echo -e "\033[32mmkdir Remote Backup folder alwyass ($ID@$IP:$Remote_BAK_Folder_BAK_Disk_X) \033[0m"
expect -c "
spawn ssh $ID@$IP \"mkdir -p $Remote_BAK_Folder_BAK_Disk_X;\"
expect {
\"*assword\" {set timeout 300; send \"$SSH_PW\r\";}
\"yes/no\" {send \"yes\r\"; }
}
expect eof"
}

MKDIR_REMOTE_BAK_Folder_BAK_Disk_Y (){
echo -e "\033[32mmkdir Remote Backup folder alwyass ($ID@$IP:$Remote_BAK_Folder_BAK_Disk_Y) \033[0m"
expect -c "
spawn ssh $ID@$IP \"mkdir -p $Remote_BAK_Folder_BAK_Disk_Y;\"
expect {
\"*assword\" {set timeout 300; send \"$SSH_PW\r\";}
\"yes/no\" {send \"yes\r\"; }
}
expect eof"
}

SCP_TO_BAK_Disk_X (){
echo -e "\033[32mSCP the backup files to Backup_Disk_X...\033[0m"
expect -c "
spawn scp $BAK_1 $ID@$IP:$REMOTE_X_BAK_1
expect {
\"*assword\" {set timeout 300; send \"$SSH_PW\r\";}
\"yes/no\" {send \"yes\r\"; }
}

spawn scp $BAK_2 $ID@$IP:$REMOTE_X_BAK_2
expect {
\"*assword\" {set timeout 300; send \"$SSH_PW\r\";}
\"yes/no\" {send \"yes\r\"; }
}

spawn scp $BAK_3 $ID@$IP:$REMOTE_X_BAK_3
expect {
\"*assword\" {set timeout 300; send \"$SSH_PW\r\";}
\"yes/no\" {send \"yes\r\"; }
}
expect eof"
}

SCP_TO_BAK_Disk_Y (){
echo -e "\033[32mSCP the backup files to Backup_Disk_Y...\033[0m"
expect -c "
spawn scp $BAK_1 $ID@$IP:$REMOTE_Y_BAK_1
expect {
\"*assword\" {set timeout 300; send \"$SSH_PW\r\";}
\"yes/no\" {send \"yes\r\"; }
}

spawn scp $BAK_2 $ID@$IP:$REMOTE_Y_BAK_2
expect {
\"*assword\" {set timeout 300; send \"$SSH_PW\r\";}
\"yes/no\" {send \"yes\r\"; }
}

spawn scp $BAK_3 $ID@$IP:$REMOTE_Y_BAK_3
expect {
\"*assword\" {set timeout 300; send \"$SSH_PW\r\";}
\"yes/no\" {send \"yes\r\"; }
}
expect eof"
}


CHK_WORK_Folder
CHK_SRC_BAK_Folder
CHK_PW_File
CHK_REMOTE_IP_AVA
CHK_BAK1
CHK_BAK2
CHK_BAK3
#MKDIR_REMOTE_BAK_Folder_BAK_Disk_X
#SCP_TO_BAK_Disk_X
#MKDIR_REMOTE_BAK_Folder_BAK_Disk_Y
#SCP_TO_BAK_Disk_Y


echo
echo -e "\033[33mDone \033[0m"
echo

+ 223
- 0
ED8Remote_backup.sh.SRC Datei anzeigen

@@ -0,0 +1,223 @@
#!/bin/bash
if [ "$#" -ne 2 ]; then
echo
echo -e "######################################################################"
echo -e "######\033[41;37m Wrong paraments input, please refer below usage info !!! \033[0m######"
echo -e "######################################################################"
echo
echo -e "Usage: \033[44;37m./<cmd.sh> <Remote ssh ID> <Remote ssh IP>\033[0m"
echo -e "Example\t: \033[45;37m$0 ed 127.0.0.1\033[0m"
echo; exit 1
fi

BAK_Project=ED8
WHO=`whoami`
HOSTNAME=`hostnamectl | grep "Static hostname" | awk '{print $NF}'`
TS=`date +"%Y%m%d-%H%M%S"`

# Host Local Backup info setup
WORK_Folder=/ED/$BAK_Project/Script_$BAK_Project
Source_BAK_Folder=/ED/$BAK_Project/Backup_file
BAK_1=$Source_BAK_Folder/backup-mysql-$BAK_Project.gz
BAK_2=$Source_BAK_Folder/Script_$BAK_Project.tar
BAK_3=$Source_BAK_Folder/Source_Files_$BAK_Project.tar

# Remote ssh Backup info setup
PW_File=/home/$WHO/PW/Remote_ssh.info
ID=$1
IP=$2
Remote_BAK_Folder_BAK_Disk_X=/BAK_Disk_A/$HOSTNAME/$BAK_Project/Backup_file
Remote_BAK_Folder_BAK_Disk_Y=/BAK_Disk_B/$HOSTNAME/$BAK_Project/Backup_file
REMOTE_X_BAK_1=$Remote_BAK_Folder_BAK_Disk_X/backup-mysql-$BAK_Project-$TS.gz
REMOTE_X_BAK_2=$Remote_BAK_Folder_BAK_Disk_X/Script_$BAK_Project-$TS.tar
REMOTE_X_BAK_3=$Remote_BAK_Folder_BAK_Disk_X/Source_Files_$BAK_Project-$TS.tar
REMOTE_Y_BAK_1=$Remote_BAK_Folder_BAK_Disk_Y/backup-mysql-$BAK_Project-$TS.gz
REMOTE_Y_BAK_2=$Remote_BAK_Folder_BAK_Disk_Y/Script_$BAK_Project-$TS.tar
REMOTE_Y_BAK_3=$Remote_BAK_Folder_BAK_Disk_Y/Source_Files_$BAK_Project-$TS.tar


##### Func
CHK_WORK_Folder (){
echo -e "\033[32mCheck Work Folder ($WORK_Folder) \033[0m"
ls $WORK_Folder > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " \033[34mPass. \033[0m"
else
echo -e " \033[31mFail. Exit.\033[0m"
echo
exit
fi
}

CHK_SRC_BAK_Folder (){
echo -e "\033[32mCheck local Backup source folder ($Source_BAK_Folder) \033[0m"
ls $Source_BAK_Folder > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " \033[34mPass. \033[0m"
else
echo -e " \033[31mFail. Exit.\033[0m"
echo
exit
fi
}

CHK_PW_File (){
echo -e "\033[32mCheck PW file ($PW_File) \033[0m"
ls $PW_File > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " \033[34mPass. \033[0m"
SSH_ID=`cat $PW_File | grep ID | awk '{print $NF}'`
if [[ $SSH_ID != "" ]]; then
echo -e " - \033[34mSSH ID: Good \033[0m"
else
echo -e " - \033[31mSSH ID: Bad. ID is empty\033[0m"
fi
SSH_PW=`cat $PW_File | grep PW | awk '{print $NF}'`
if [[ $SSH_PW != "" ]]; then
echo -e " - \033[34mSSH PW: Good \033[0m"
else
echo -e " - \033[31mSSH PW: Bad. ID is empty\033[0m"
fi
else
echo -e " \033[31mFail. There is no PW file ($PW_File). Please make a new one. Exit. \033[0m"
echo -e " Example of $PW_File: "
echo -e " ID xxxx"
echo -e " PW zzzzzzzz"
echo
exit
fi
}

CHK_REMOTE_IP_AVA (){
echo -e "\033[32mCheck IP ($IP) availiable - ping ($IP) \033[0m"
ping -c1 $IP > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " \033[34mPass. \033[0m"
else
echo -e " \033[31mFail. There is no ping in IP ($IP). Exit \033[0m"
echo
exit
fi
}

CHK_BAK1 (){
echo -e "\033[32mCheck local Backup file status ($BAK_1) \033[0m"
ls $BAK_1 > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " \033[34mPass. \033[0m"
else
echo -e " \033[31mFail. Exit.\033[0m"
echo
exit
fi
}

CHK_BAK2 (){
echo -e "\033[32mCheck local Backup file status ($BAK_2) \033[0m"
ls $BAK_2 > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " \033[34mPass. \033[0m"
else
echo -e " \033[31mFail. Exit.\033[0m"
echo
exit
fi
}

CHK_BAK3 (){
echo -e "\033[32mCheck local Backup file status ($BAK_3) \033[0m"
ls $BAK_2 > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e " \033[34mPass. \033[0m"
else
echo -e " \033[31mFail. Exit.\033[0m"
echo
exit
fi
}

MKDIR_REMOTE_BAK_Folder_BAK_Disk_X (){
echo -e "\033[32mmkdir Remote Backup folder alwyass ($ID@$IP:$Remote_BAK_Folder_BAK_Disk_X) \033[0m"
expect -c "
spawn ssh $ID@$IP \"mkdir -p $Remote_BAK_Folder_BAK_Disk_X;\"
expect {
\"*assword\" {set timeout 300; send \"$SSH_PW\r\";}
\"yes/no\" {send \"yes\r\"; }
}
expect eof"
}

MKDIR_REMOTE_BAK_Folder_BAK_Disk_Y (){
echo -e "\033[32mmkdir Remote Backup folder alwyass ($ID@$IP:$Remote_BAK_Folder_BAK_Disk_Y) \033[0m"
expect -c "
spawn ssh $ID@$IP \"mkdir -p $Remote_BAK_Folder_BAK_Disk_Y;\"
expect {
\"*assword\" {set timeout 300; send \"$SSH_PW\r\";}
\"yes/no\" {send \"yes\r\"; }
}
expect eof"
}

SCP_TO_BAK_Disk_X (){
echo -e "\033[32mSCP the backup files to Backup_Disk_X...\033[0m"
expect -c "
spawn scp $BAK_1 $ID@$IP:$REMOTE_X_BAK_1
expect {
\"*assword\" {set timeout 300; send \"$SSH_PW\r\";}
\"yes/no\" {send \"yes\r\"; }
}

spawn scp $BAK_2 $ID@$IP:$REMOTE_X_BAK_2
expect {
\"*assword\" {set timeout 300; send \"$SSH_PW\r\";}
\"yes/no\" {send \"yes\r\"; }
}

spawn scp $BAK_3 $ID@$IP:$REMOTE_X_BAK_3
expect {
\"*assword\" {set timeout 300; send \"$SSH_PW\r\";}
\"yes/no\" {send \"yes\r\"; }
}
expect eof"
}

SCP_TO_BAK_Disk_Y (){
echo -e "\033[32mSCP the backup files to Backup_Disk_Y...\033[0m"
expect -c "
spawn scp $BAK_1 $ID@$IP:$REMOTE_Y_BAK_1
expect {
\"*assword\" {set timeout 300; send \"$SSH_PW\r\";}
\"yes/no\" {send \"yes\r\"; }
}

spawn scp $BAK_2 $ID@$IP:$REMOTE_Y_BAK_2
expect {
\"*assword\" {set timeout 300; send \"$SSH_PW\r\";}
\"yes/no\" {send \"yes\r\"; }
}

spawn scp $BAK_3 $ID@$IP:$REMOTE_Y_BAK_3
expect {
\"*assword\" {set timeout 300; send \"$SSH_PW\r\";}
\"yes/no\" {send \"yes\r\"; }
}
expect eof"
}


CHK_WORK_Folder
CHK_SRC_BAK_Folder
CHK_PW_File
CHK_REMOTE_IP_AVA
CHK_BAK1
CHK_BAK2
CHK_BAK3
#MKDIR_REMOTE_BAK_Folder_BAK_Disk_X
#SCP_TO_BAK_Disk_X
#MKDIR_REMOTE_BAK_Folder_BAK_Disk_Y
#SCP_TO_BAK_Disk_Y


echo
echo -e "\033[33mDone \033[0m"
echo

+ 34
- 18
ED8backup-Script_ED8-Auto.sh Datei anzeigen

@@ -1,26 +1,31 @@
#!/bin/bash
BAK_Project=ED8
USER=`whoami`
LOG_Folder="_LOG"
LOG1=/ED/ED8/Script_ED8/_LOG/ED8backup-Script_ED8.log
LOG1=/ED/$BAK_Project/Script_$BAK_Project/_LOG/${BAK_Project}backup-Script_${BAK_Project}.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_Folder="/ED/${BAK_Project}/Backup_file"
Bak_File_Name=$Bak_Folder/Script_${BAK_Project}.tar
Bak_File_Name_TS=$Bak_Folder/Script_${BAK_Project}-$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"
BAK_Disk_A_Script_BAK_Folder="$BAK_Disk_A_Hostname_Folder/${BAK_Project}/Backup_file"
BAK_Disk_A_Script_Bak_File_Name_TS="$BAK_Disk_A_Script_BAK_Folder/Script_${BAK_Project}-$TS.tar"
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_Script_BAK_Folder="$BAK_Disk_B_Hostname_Folder/${BAK_Project}/Backup_file"
BAK_Disk_B_Script_Bak_File_Name_TS="$BAK_Disk_B_Script_BAK_Folder/Script_${BAK_Project}-$TS.tar"

Target_Folder=/ED/ED8/Script_ED8
Target_Folder=/ED/${BAK_Project}/Script_${BAK_Project}


##### Func
CHK_LOG_Folder (){
ls /ED/ED8/Script_ED8/_LOG > /dev/null 2>&1
ls /ED/${BAK_Project}/Script_${BAK_Project}/_LOG > /dev/null 2>&1
if [[ $? != 0 ]]; then
sudo mkdir -p /ED/ED8/Script_ED8/_LOG
sudo chown $USER:$USER /ED/ED8/Script_ED8/_LOG
sudo mkdir -p /ED/${BAK_Project}/Script_${BAK_Project}/_LOG
sudo chown $USER:$USER /ED/${BAK_Project}/Script_${BAK_Project}/_LOG
fi
}

@@ -38,7 +43,7 @@ CHK_Bak_Folder (){
TAR_File (){
tar cvf $Bak_File_Name $Target_Folder > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e "\033[34mPass. tar Script_ED8 file OK.\033[0m"
echo -e "\033[34mPass. tar Script_${BAK_Project} file OK.\033[0m"
cp $Bak_File_Name $Bak_File_Name_TS
if [[ $? == 0 ]]; then
echo -e "\033[34mPass. Make a copy file to \"$Bak_Folder\". Finished!\033[0m"
@@ -46,12 +51,13 @@ TAR_File (){
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"
echo -e "\033[41;37mFail. tar Script_${BAK_Project} file failed.\033[0m"
fi
}

CP_To_BAK_Disk_A (){
cp $Bak_File_Name $BAK_Disk_A_ED8_Script_Bak_File_Name_TS
CP_TO_BAK_Disk_A (){
echo -e "\033[32mCopy the backup files to Backup_Disk_A...\033[0m"
cp $Bak_File_Name $BAK_Disk_A_Script_Bak_File_Name_TS
if [[ $? == 0 ]]; then
echo -e "\033[34mPass. Copied to BAK_Disk_A. \033[0m"
else
@@ -59,15 +65,25 @@ CP_To_BAK_Disk_A (){
fi
}

CP_TO_BAK_Disk_B (){
echo -e "\033[32mCopy the backup files to Backup_Disk_B...\033[0m"
cp $Bak_File_Name $BAK_Disk_B_Script_Bak_File_Name_TS
if [[ $? == 0 ]]; then
echo -e "\033[34mPass. Copied to BAK_Disk_B. \033[0m"
else
echo -e "\033[41;37mFail. Copied to BAK_Disk_B. \033[0m"
fi
}


echo -e "===== `date +"%Y/%m/%d %H:%M:%S"` ===== \033[45;37m$0\033[0m =====" | tee -a $LOG1
echo -e "\033[32mStart backup the Script_ED8 \033[0m" | tee -a $LOG1
echo -e "\033[32mStart backup the Script_${BAK_Project} \033[0m" | tee -a $LOG1
CHK_LOG_Folder | tee -a $LOG1
CHK_Bak_Folder | tee -a $LOG1
TAR_File | tee -a $LOG1
echo | tee -a $LOG1
CP_TO_BAK_Disk_A | tee -a $LOG1
CP_TO_BAK_Disk_B | tee -a $LOG1

echo -e "\033[32mStart backup the Script_ED8 to BAK_Disk_A \033[0m" | tee -a $LOG1
CP_To_BAK_Disk_A | tee -a $LOG1
echo | tee -a $LOG1

echo

+ 92
- 0
ED8backup-Script_ED8-Auto.sh.SRC Datei anzeigen

@@ -0,0 +1,92 @@
#!/bin/bash
BAK_Project=ED8
USER=`whoami`
LOG_Folder="_LOG"
LOG1=/ED/$BAK_Project/Script_$BAK_Project/_LOG/${BAK_Project}backup-Script_${BAK_Project}.log
TS=`date +"%Y%m%d-%H%M%S"`
Bak_Folder="/ED/${BAK_Project}/Backup_file"
Bak_File_Name=$Bak_Folder/Script_${BAK_Project}.tar
Bak_File_Name_TS=$Bak_Folder/Script_${BAK_Project}-$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_Script_BAK_Folder="$BAK_Disk_A_Hostname_Folder/${BAK_Project}/Backup_file"
BAK_Disk_A_Script_Bak_File_Name_TS="$BAK_Disk_A_Script_BAK_Folder/Script_${BAK_Project}-$TS.tar"
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_Script_BAK_Folder="$BAK_Disk_B_Hostname_Folder/${BAK_Project}/Backup_file"
BAK_Disk_B_Script_Bak_File_Name_TS="$BAK_Disk_B_Script_BAK_Folder/Script_${BAK_Project}-$TS.tar"

Target_Folder=/ED/${BAK_Project}/Script_${BAK_Project}


##### Func
CHK_LOG_Folder (){
ls /ED/${BAK_Project}/Script_${BAK_Project}/_LOG > /dev/null 2>&1
if [[ $? != 0 ]]; then
sudo mkdir -p /ED/${BAK_Project}/Script_${BAK_Project}/_LOG
sudo chown $USER:$USER /ED/${BAK_Project}/Script_${BAK_Project}/_LOG
fi
}

CHK_Bak_Folder (){
ls $Bak_Folder > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e "\033[34mPass. 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"
sudo mkdir -p $Bak_Folder
sudo chown $USER:$USER $Bak_Folder
fi
}

TAR_File (){
tar cvf $Bak_File_Name $Target_Folder > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e "\033[34mPass. tar Script_${BAK_Project} file OK.\033[0m"
cp $Bak_File_Name $Bak_File_Name_TS
if [[ $? == 0 ]]; then
echo -e "\033[34mPass. 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_${BAK_Project} file failed.\033[0m"
fi
}

CP_TO_BAK_Disk_A (){
echo -e "\033[32mCopy the backup files to Backup_Disk_A...\033[0m"
cp $Bak_File_Name $BAK_Disk_A_Script_Bak_File_Name_TS
if [[ $? == 0 ]]; then
echo -e "\033[34mPass. Copied to BAK_Disk_A. \033[0m"
else
echo -e "\033[41;37mFail. Copied to BAK_Disk_A. \033[0m"
fi
}

CP_TO_BAK_Disk_B (){
echo -e "\033[32mCopy the backup files to Backup_Disk_B...\033[0m"
cp $Bak_File_Name $BAK_Disk_B_Script_Bak_File_Name_TS
if [[ $? == 0 ]]; then
echo -e "\033[34mPass. Copied to BAK_Disk_B. \033[0m"
else
echo -e "\033[41;37mFail. Copied to BAK_Disk_B. \033[0m"
fi
}


echo -e "===== `date +"%Y/%m/%d %H:%M:%S"` ===== \033[45;37m$0\033[0m =====" | tee -a $LOG1
echo -e "\033[32mStart backup the Script_${BAK_Project} \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
#CP_TO_BAK_Disk_B | tee -a $LOG1

echo | tee -a $LOG1

echo
echo -e "\033[33mLOG file:"
echo -e " $LOG1\033[0m"
echo

+ 32
- 16
ED8backup-Source_Files-Auto.sh Datei anzeigen

@@ -1,26 +1,31 @@
#!/bin/bash
BAK_Project=ED8
USER=`whoami`
LOG_Folder="_LOG"
LOG1=/ED/ED8/Script_ED8/_LOG/ED8backup-Source_Files.log
LOG1=/ED/${BAK_Project}/Script_${BAK_Project}/_LOG/${BAK_Project}backup-Source_Files.log
TS=`date +"%Y%m%d-%H%M%S"`
Bak_Folder="/ED/ED8/Backup_file"
Bak_File_Name=$Bak_Folder/Source_Files.tar
Bak_File_Name_TS=$Bak_Folder/Source_Files-$TS.tar
Bak_Folder="/ED/${BAK_Project}/Backup_file"
Bak_File_Name=$Bak_Folder/Source_Files_${BAK_Project}.tar
Bak_File_Name_TS=$Bak_Folder/Source_Files_${BAK_Project}-$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/Source_Files-$TS.gz"
BAK_Disk_A_Script_BAK_Folder="$BAK_Disk_A_Hostname_Folder/${BAK_Project}/Backup_file"
BAK_Disk_A_Script_Bak_File_Name_TS="$BAK_Disk_A_Script_BAK_Folder/Source_Files_${BAK_Project}-$TS.tar"
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_Script_BAK_Folder="$BAK_Disk_B_Hostname_Folder/${BAK_Project}/Backup_file"
BAK_Disk_B_Script_Bak_File_Name_TS="$BAK_Disk_B_Script_BAK_Folder/Source_Files_${BAK_Project}-$TS.tar"

Target_Folder=/ED/ED8/Source_Files
Target_Folder=/ED/${BAK_Project}/Source_Files


##### Func
CHK_LOG_Folder (){
ls /ED/ED8/Script_ED8/_LOG > /dev/null 2>&1
ls /ED/${BAK_Project}/Script_${BAK_Project}/_LOG > /dev/null 2>&1
if [[ $? != 0 ]]; then
sudo mkdir -p /ED/ED8/Script_ED8/_LOG
sudo chown $USER:$USER /ED/ED8/Script_ED8/_LOG
sudo mkdir -p /ED/${BAK_Project}/Script_${BAK_Project}/_LOG
sudo chown $USER:$USER /ED/${BAK_Project}/Script_${BAK_Project}/_LOG
fi
}

@@ -50,8 +55,9 @@ TAR_File (){
fi
}

CP_To_BAK_Disk_A (){
cp $Bak_File_Name $BAK_Disk_A_ED8_Script_Bak_File_Name_TS
CP_TO_BAK_Disk_A (){
echo -e "\033[32mCopy the backup files to Backup_Disk_A...\033[0m"
cp $Bak_File_Name $BAK_Disk_A_Script_Bak_File_Name_TS
if [[ $? == 0 ]]; then
echo -e "\033[34mPass. Copied to BAK_Disk_A. \033[0m"
else
@@ -59,15 +65,25 @@ CP_To_BAK_Disk_A (){
fi
}

CP_TO_BAK_Disk_B (){
echo -e "\033[32mCopy the backup files to Backup_Disk_B...\033[0m"
cp $Bak_File_Name $BAK_Disk_B_Script_Bak_File_Name_TS
if [[ $? == 0 ]]; then
echo -e "\033[34mPass. Copied to BAK_Disk_B. \033[0m"
else
echo -e "\033[41;37mFail. Copied to BAK_Disk_B. \033[0m"
fi
}


echo -e "===== `date +"%Y/%m/%d %H:%M:%S"` ===== \033[45;37m$0\033[0m =====" | tee -a $LOG1
echo -e "\033[32mStart backup the ED8 Source_Files \033[0m" | tee -a $LOG1
echo -e "\033[32mStart backup the ${BAK_Project} Source_Files \033[0m" | tee -a $LOG1
CHK_LOG_Folder | tee -a $LOG1
CHK_Bak_Folder | tee -a $LOG1
TAR_File | tee -a $LOG1
echo | tee -a $LOG1
CP_TO_BAK_Disk_A | tee -a $LOG1
CP_TO_BAK_Disk_B | tee -a $LOG1

echo -e "\033[32mStart backup the ED8 Source_Files to BAK_Disk_A \033[0m" | tee -a $LOG1
CP_To_BAK_Disk_A | tee -a $LOG1
echo | tee -a $LOG1

echo

+ 92
- 0
ED8backup-Source_Files-Auto.sh.SRC Datei anzeigen

@@ -0,0 +1,92 @@
#!/bin/bash
BAK_Project=ED8
USER=`whoami`
LOG_Folder="_LOG"
LOG1=/ED/${BAK_Project}/Script_${BAK_Project}/_LOG/${BAK_Project}backup-Source_Files.log
TS=`date +"%Y%m%d-%H%M%S"`
Bak_Folder="/ED/${BAK_Project}/Backup_file"
Bak_File_Name=$Bak_Folder/Source_Files_${BAK_Project}.tar
Bak_File_Name_TS=$Bak_Folder/Source_Files_${BAK_Project}-$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_Script_BAK_Folder="$BAK_Disk_A_Hostname_Folder/${BAK_Project}/Backup_file"
BAK_Disk_A_Script_Bak_File_Name_TS="$BAK_Disk_A_Script_BAK_Folder/Source_Files_${BAK_Project}-$TS.tar"
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_Script_BAK_Folder="$BAK_Disk_B_Hostname_Folder/${BAK_Project}/Backup_file"
BAK_Disk_B_Script_Bak_File_Name_TS="$BAK_Disk_B_Script_BAK_Folder/Source_Files_${BAK_Project}-$TS.tar"

Target_Folder=/ED/${BAK_Project}/Source_Files


##### Func
CHK_LOG_Folder (){
ls /ED/${BAK_Project}/Script_${BAK_Project}/_LOG > /dev/null 2>&1
if [[ $? != 0 ]]; then
sudo mkdir -p /ED/${BAK_Project}/Script_${BAK_Project}/_LOG
sudo chown $USER:$USER /ED/${BAK_Project}/Script_${BAK_Project}/_LOG
fi
}

CHK_Bak_Folder (){
ls $Bak_Folder > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e "\033[34mPass. 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"
sudo mkdir -p $Bak_Folder
sudo chown $USER:$USER $Bak_Folder
fi
}

TAR_File (){
tar cvf $Bak_File_Name $Target_Folder > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo -e "\033[34mPass. tar Source_Files file OK.\033[0m"
cp $Bak_File_Name $Bak_File_Name_TS
if [[ $? == 0 ]]; then
echo -e "\033[34mPass. 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 Source_Files file failed.\033[0m"
fi
}

CP_TO_BAK_Disk_A (){
echo -e "\033[32mCopy the backup files to Backup_Disk_A...\033[0m"
cp $Bak_File_Name $BAK_Disk_A_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
}

CP_TO_BAK_Disk_B (){
echo -e "\033[32mCopy the backup files to Backup_Disk_B...\033[0m"
cp $Bak_File_Name $BAK_Disk_B_Script_Bak_File_Name_TS
if [[ $? == 0 ]]; then
echo -e "\033[34mPass. Copied to BAK_Disk_B. \033[0m"
else
echo -e "\033[41;37mFail. Copied to BAK_Disk_B. \033[0m"
fi
}


echo -e "===== `date +"%Y/%m/%d %H:%M:%S"` ===== \033[45;37m$0\033[0m =====" | tee -a $LOG1
echo -e "\033[32mStart backup the ${BAK_Project} Source_Files \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
#CP_TO_BAK_Disk_B | tee -a $LOG1

echo | tee -a $LOG1

echo
echo -e "\033[33mLOG file:"
echo -e " $LOG1\033[0m"
echo

+ 56
- 55
ED8backup-mysql-Auto.sh Datei anzeigen

@@ -1,30 +1,31 @@
#!/bin/bash
BAK_Project=ED8
USER=`whoami`
PWFile="/home/$USER/PW/mysql_ED8.info"
PWFile="/home/$USER/PW/mysql_${BAK_Project}.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
LOG_Folder="/ED/${BAK_Project}/Script_${BAK_Project}/_LOG"
LOG1=/ED/${BAK_Project}/Script_${BAK_Project}/_LOG/${BAK_Project}backup-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_Folder="/ED/${BAK_Project}/Backup_file"
Bak_File_Name=$Bak_Folder/backup-mysql-${BAK_Project}.gz
Bak_File_Name_TS=$Bak_Folder/backup-mysql-${BAK_Project}-$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_A_BAK_Folder="$BAK_Disk_A_Hostname_Folder/${BAK_Project}/Backup_file"
BAK_Disk_A_Bak_File_Name_TS="$BAK_Disk_A_BAK_Folder/backup-mysql-${BAK_Project}-$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"
BAK_Disk_B_BAK_Folder="$BAK_Disk_B_Hostname_Folder/${BAK_Project}/Backup_file"
BAK_Disk_B_Bak_File_Name_TS="$BAK_Disk_B_BAK_Folder/backup-mysql-${BAK_Project}-$TS.gz"


##### FUNC
@@ -36,7 +37,7 @@ CHK_PWFile (){
echo
echo -e "$PWFile Content example: "
echo -e "Database_Name: db_ed8_"
echo -e "ID: root"
echo -e "ID: ed"
echo -e "Password: +039*******"
echo
exit
@@ -77,7 +78,7 @@ CHK_LOG_Folder (){
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
sudo chown $USER:$USER $LOG_Folder -R
if [[ $? != 0 ]]; then
echo -e " >> \033[41;37mCreate the folder failed. Exit\033[0m"
echo
@@ -88,15 +89,15 @@ CHK_LOG_Folder (){
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
CHK_Bak_Folder (){
echo -e "\033[32mCheck the local original backup folder exist: \033[35m($Bak_Folder) \033[0m"
ls $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
echo -e " >> \033[34mPass. Backup file saving folder: $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
echo -e " >> \033[33mWarning! There is no Backup file saving folder: $Bak_Folder, next will create a new one automatically.\033[0m" | tee -a $LOG1
sudo mkdir -p $Bak_Folder
sudo chown $USER:$USER $Bak_Folder -R
if [[ $? != 0 ]]; then
echo -e " >> \033[41;37mCreate the folder failed. Exit\033[0m"
echo
@@ -109,29 +110,29 @@ 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
mysqldump -u $DATABASEUser -p$DATABASEPassword $DATABASEName | gzip > $Bak_File_Name
# mysqldump -u $DATABASEUser -p$DATABASEPassword $DATABASEName | gzip > $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 -e " >> \033[31m # sudo mysqldump -u ed -p db_ed8_ | gzip > $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 " \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
cp $Bak_File_Name $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
echo -e " >> \033[34mPass. Make a copy OK - \033[35m($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 -e " >> \033[41;37mFail. Make a copy failed. Exit\033[0m - \033[35m($Bak_File_Name_TS) \033[0m" | tee -a $LOG1
echo
exit
fi
@@ -169,7 +170,7 @@ CHK_BAK_Disk_A_Mount_Point (){
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
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
@@ -187,7 +188,7 @@ CHK_BAK_Disk_B_Mount_Point (){
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
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
@@ -229,7 +230,7 @@ CHK_BAK_Disk_A_Hostname_Folder (){
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
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
@@ -246,7 +247,7 @@ CHK_BAK_Disk_B_Hostname_Folder (){
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
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
@@ -255,15 +256,15 @@ CHK_BAK_Disk_B_Hostname_Folder (){
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
CHK_BAK_Disk_A_BAK_Folder (){
echo -e "\033[32mCheck the BAK_Disk_A ${BAK_Project} backup folder status: \033[35m($BAK_Disk_A_BAK_Folder) \033[0m"
ls $BAK_Disk_A_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
echo -e " >> \033[34mPass. BAK_Disk's Backup file saving folder: $BAK_Disk_A_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
echo -e " >> \033[33mWarning! There is no BAK_Disk's Backup file saving folder: $BAK_Disk_A_BAK_Folder, next will create a new one automatically.\033[0m" | tee -a $LOG1
sudo mkdir -p $BAK_Disk_A_BAK_Folder
sudo chown $USER:$USER $BAK_Disk_A_BAK_Folder -R
if [[ $? != 0 ]]; then
echo -e " >> \033[41;37mCreate the folder failed. Exit\033[0m"
echo
@@ -272,15 +273,15 @@ CHK_BAK_Disk_A_ED8_BAK_Folder (){
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
CHK_BAK_Disk_B_BAK_Folder (){
echo -e "\033[32mCheck the BAK_Disk_B ${BAK_Project} backup folder status: \033[35m($BAK_Disk_B_BAK_Folder) \033[0m"
ls $BAK_Disk_B_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
echo -e " >> \033[34mPass. BAK_Disk's Backup file saving folder: $BAK_Disk_B_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
echo -e " >> \033[33mWarning! There is no BAK_Disk's Backup file saving folder: $BAK_Disk_B_BAK_Folder, next will create a new one automatically.\033[0m" | tee -a $LOG1
sudo mkdir -p $BAK_Disk_B_BAK_Folder
sudo chown $USER:$USER $BAK_Disk_B_BAK_Folder -R

if [[ $? != 0 ]]; then
echo -e " >> \033[41;37mCreate the folder failed. Exit\033[0m"
@@ -292,15 +293,15 @@ CHK_BAK_Disk_B_ED8_BAK_Folder (){

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
cp $Bak_File_Name_TS $BAK_Disk_A_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
echo -e " >> \033[34mPass. Make a copy OK - \033[35m($BAK_Disk_A_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 -e " >> \033[41;37mFail. Make a copy failed. Exit\033[0m - \033[35m($BAK_Disk_A_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 -e " \033[41;37m# sudo chown $USER:$USER $BAK_Disk_A_Mount_Point \033[0m"
echo
exit
fi
@@ -308,15 +309,15 @@ CP_TO_BAK_Disk_A (){

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
cp $Bak_File_Name_TS $BAK_Disk_B_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
echo -e " >> \033[34mPass. Make a copy OK - \033[35m($BAK_Disk_B_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 -e " >> \033[41;37mFail. Make a copy failed. Exit\033[0m - \033[35m($BAK_Disk_B_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 -e " \033[41;37m# sudo chown $USER:$USER $BAK_Disk_B_Mount_Point \033[0m"
echo
exit
fi
@@ -325,19 +326,19 @@ CP_TO_BAK_Disk_B (){
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
CHK_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
CHK_BAK_Disk_A_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
CHK_BAK_Disk_B_BAK_Folder
CP_TO_BAK_Disk_B



+ 47
- 46
ED8backup-mysql-Auto.sh.SRC Datei anzeigen

@@ -1,30 +1,31 @@
#!/bin/bash
BAK_Project=ED8
USER=`whoami`
PWFile="/home/$USER/PW/mysql_ED8.info"
PWFile="/home/$USER/PW/mysql_${BAK_Project}.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
LOG_Folder="/ED/${BAK_Project}/Script_${BAK_Project}/_LOG"
LOG1=/ED/${BAK_Project}/Script_${BAK_Project}/_LOG/${BAK_Project}backup-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_Folder="/ED/${BAK_Project}/Backup_file"
Bak_File_Name=$Bak_Folder/backup-mysql-${BAK_Project}.gz
Bak_File_Name_TS=$Bak_Folder/backup-mysql-${BAK_Project}-$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_A_BAK_Folder="$BAK_Disk_A_Hostname_Folder/${BAK_Project}/Backup_file"
BAK_Disk_A_Bak_File_Name_TS="$BAK_Disk_A_BAK_Folder/backup-mysql-${BAK_Project}-$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"
BAK_Disk_B_BAK_Folder="$BAK_Disk_B_Hostname_Folder/${BAK_Project}/Backup_file"
BAK_Disk_B_Bak_File_Name_TS="$BAK_Disk_B_BAK_Folder/backup-mysql-${BAK_Project}-$TS.gz"


##### FUNC
@@ -88,15 +89,15 @@ CHK_LOG_Folder (){
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
CHK_Bak_Folder (){
echo -e "\033[32mCheck the local original backup folder exist: \033[35m($Bak_Folder) \033[0m"
ls $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
echo -e " >> \033[34mPass. Backup file saving folder: $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
echo -e " >> \033[33mWarning! There is no Backup file saving folder: $Bak_Folder, next will create a new one automatically.\033[0m" | tee -a $LOG1
sudo mkdir -p $Bak_Folder
sudo chown $USER:$USER $Bak_Folder -R
if [[ $? != 0 ]]; then
echo -e " >> \033[41;37mCreate the folder failed. Exit\033[0m"
echo
@@ -109,14 +110,14 @@ 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
/opt/lampp/bin/mysqldump -u $DATABASEUser -p$DATABASEPassword $DATABASEName | gzip > $Bak_File_Name
# mysqldump -u $DATABASEUser -p$DATABASEPassword $DATABASEName | gzip > $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 -e " >> \033[31m # sudo /opt/lampp/bin/mysqldump -u ed -p db_ed8_ | gzip > $Bak_File_Name \033[0m" | tee -a $LOG1
echo
exit
fi
@@ -127,11 +128,11 @@ Mysql_Dump (){
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
cp $Bak_File_Name $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
echo -e " >> \033[34mPass. Make a copy OK - \033[35m($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 -e " >> \033[41;37mFail. Make a copy failed. Exit\033[0m - \033[35m($Bak_File_Name_TS) \033[0m" | tee -a $LOG1
echo
exit
fi
@@ -255,15 +256,15 @@ CHK_BAK_Disk_B_Hostname_Folder (){
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
CHK_BAK_Disk_A_BAK_Folder (){
echo -e "\033[32mCheck the BAK_Disk_A ${BAK_Project} backup folder status: \033[35m($BAK_Disk_A_BAK_Folder) \033[0m"
ls $BAK_Disk_A_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
echo -e " >> \033[34mPass. BAK_Disk's Backup file saving folder: $BAK_Disk_A_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
echo -e " >> \033[33mWarning! There is no BAK_Disk's Backup file saving folder: $BAK_Disk_A_BAK_Folder, next will create a new one automatically.\033[0m" | tee -a $LOG1
sudo mkdir -p $BAK_Disk_A_BAK_Folder
sudo chown $USER:$USER $BAK_Disk_A_BAK_Folder -R
if [[ $? != 0 ]]; then
echo -e " >> \033[41;37mCreate the folder failed. Exit\033[0m"
echo
@@ -272,15 +273,15 @@ CHK_BAK_Disk_A_ED8_BAK_Folder (){
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
CHK_BAK_Disk_B_BAK_Folder (){
echo -e "\033[32mCheck the BAK_Disk_B ${BAK_Project} backup folder status: \033[35m($BAK_Disk_B_BAK_Folder) \033[0m"
ls $BAK_Disk_B_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
echo -e " >> \033[34mPass. BAK_Disk's Backup file saving folder: $BAK_Disk_B_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
echo -e " >> \033[33mWarning! There is no BAK_Disk's Backup file saving folder: $BAK_Disk_B_BAK_Folder, next will create a new one automatically.\033[0m" | tee -a $LOG1
sudo mkdir -p $BAK_Disk_B_BAK_Folder
sudo chown $USER:$USER $BAK_Disk_B_BAK_Folder -R

if [[ $? != 0 ]]; then
echo -e " >> \033[41;37mCreate the folder failed. Exit\033[0m"
@@ -292,11 +293,11 @@ CHK_BAK_Disk_B_ED8_BAK_Folder (){

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
cp $Bak_File_Name_TS $BAK_Disk_A_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
echo -e " >> \033[34mPass. Make a copy OK - \033[35m($BAK_Disk_A_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 -e " >> \033[41;37mFail. Make a copy failed. Exit\033[0m - \033[35m($BAK_Disk_A_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"
@@ -308,11 +309,11 @@ CP_TO_BAK_Disk_A (){

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
cp $Bak_File_Name_TS $BAK_Disk_B_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
echo -e " >> \033[34mPass. Make a copy OK - \033[35m($BAK_Disk_B_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 -e " >> \033[41;37mFail. Make a copy failed. Exit\033[0m - \033[35m($BAK_Disk_B_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"
@@ -325,19 +326,19 @@ CP_TO_BAK_Disk_B (){
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
CHK_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
#CHK_BAK_Disk_A_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
#CHK_BAK_Disk_B_BAK_Folder
#CP_TO_BAK_Disk_B



+ 0
- 347
ED8backup-mysql-Auto.sh.TMP Datei anzeigen

@@ -1,347 +0,0 @@
#!/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

+ 0
- 63
ED8restore_from_local-mysql.sh.TMP Datei anzeigen

@@ -1,63 +0,0 @@
#!/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

+ 0
- 5
_LOG/ED8_restore_from_local-mysql.log Datei anzeigen

@@ -1,5 +0,0 @@
======= 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.


+ 0
- 171
_LOG/ED8backup-Script_ED8.log Datei anzeigen

@@ -1,171 +0,0 @@
===== 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. 
===== 2019/08/08 01:57:27 ===== ./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-Source_Files.log
/ED/ED8/Script_ED8/_LOG/ED8restore_from_local-mysql.log
/ED/ED8/Script_ED8/_LOG/ED8_restore_from_local-mysql.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/ED8backup-Source_Files-Auto.sh
/ED/ED8/Script_ED8/Readme.txt
/ED/ED8/Script_ED8/01.ENV_check.sh
/ED/ED8/Script_ED8/.git/
/ED/ED8/Script_ED8/.git/config
/ED/ED8/Script_ED8/.git/logs/
/ED/ED8/Script_ED8/.git/logs/refs/
/ED/ED8/Script_ED8/.git/logs/refs/heads/
/ED/ED8/Script_ED8/.git/logs/refs/heads/master
/ED/ED8/Script_ED8/.git/logs/refs/remotes/
/ED/ED8/Script_ED8/.git/logs/refs/remotes/origin/
/ED/ED8/Script_ED8/.git/logs/refs/remotes/origin/master
/ED/ED8/Script_ED8/.git/logs/HEAD
/ED/ED8/Script_ED8/.git/objects/
/ED/ED8/Script_ED8/.git/objects/5e/
/ED/ED8/Script_ED8/.git/objects/5e/adb600a72d52ed77a6173d6f71700bab0d05a6
/ED/ED8/Script_ED8/.git/objects/12/
/ED/ED8/Script_ED8/.git/objects/12/e8503bf393f95dfcc784c1cf59634c32e03be5
/ED/ED8/Script_ED8/.git/objects/59/
/ED/ED8/Script_ED8/.git/objects/59/5faf03d1bb245045660b6098450cbd05fd68b8
/ED/ED8/Script_ED8/.git/objects/d5/
/ED/ED8/Script_ED8/.git/objects/d5/9862eb564aeec36462886a47e2fdaa2670fc9d
/ED/ED8/Script_ED8/.git/objects/99/
/ED/ED8/Script_ED8/.git/objects/99/79f8bedda829c1b9917e3607fa573f734af967
/ED/ED8/Script_ED8/.git/objects/info/
/ED/ED8/Script_ED8/.git/objects/37/
/ED/ED8/Script_ED8/.git/objects/37/e151e2fea290bdd9279017f881f9f2e1bb8f31
/ED/ED8/Script_ED8/.git/objects/8c/
/ED/ED8/Script_ED8/.git/objects/8c/f99a511a69b66e3d46f03eabb4513cc9dff60d
/ED/ED8/Script_ED8/.git/objects/c3/
/ED/ED8/Script_ED8/.git/objects/c3/dc09d9e80b65b1b3d6081498ff62c9b265d2e5
/ED/ED8/Script_ED8/.git/objects/61/
/ED/ED8/Script_ED8/.git/objects/61/2b0093304ee6eeb748af318975803148216053
/ED/ED8/Script_ED8/.git/objects/9c/
/ED/ED8/Script_ED8/.git/objects/9c/5a5c578b2fe51aeffc24dbd70619993a54c057
/ED/ED8/Script_ED8/.git/objects/d2/
/ED/ED8/Script_ED8/.git/objects/d2/a798c5cd6b2e291b3b6551358e832272a86ab4
/ED/ED8/Script_ED8/.git/objects/pack/
/ED/ED8/Script_ED8/.git/objects/eb/
/ED/ED8/Script_ED8/.git/objects/eb/5ffd156c7166638470e77b2b95f954cbce0df7
/ED/ED8/Script_ED8/.git/objects/3f/
/ED/ED8/Script_ED8/.git/objects/3f/1aa6f5f9051b7f483e49960677fa368826edfa
/ED/ED8/Script_ED8/.git/objects/fc/
/ED/ED8/Script_ED8/.git/objects/fc/61c675eb5baffc2393f98965d37cade0176420
/ED/ED8/Script_ED8/.git/objects/90/
/ED/ED8/Script_ED8/.git/objects/90/ef34324e1a9b1737f90e839246818f58888373
/ED/ED8/Script_ED8/.git/info/
/ED/ED8/Script_ED8/.git/info/exclude
/ED/ED8/Script_ED8/.git/refs/
/ED/ED8/Script_ED8/.git/refs/tags/
/ED/ED8/Script_ED8/.git/refs/heads/
/ED/ED8/Script_ED8/.git/refs/heads/master
/ED/ED8/Script_ED8/.git/refs/remotes/
/ED/ED8/Script_ED8/.git/refs/remotes/origin/
/ED/ED8/Script_ED8/.git/refs/remotes/origin/master
/ED/ED8/Script_ED8/.git/HEAD
/ED/ED8/Script_ED8/.git/index
/ED/ED8/Script_ED8/.git/COMMIT_EDITMSG
/ED/ED8/Script_ED8/.git/description
/ED/ED8/Script_ED8/.git/branches/
/ED/ED8/Script_ED8/.git/hooks/
/ED/ED8/Script_ED8/.git/hooks/prepare-commit-msg.sample
/ED/ED8/Script_ED8/.git/hooks/update.sample
/ED/ED8/Script_ED8/.git/hooks/pre-push.sample
/ED/ED8/Script_ED8/.git/hooks/applypatch-msg.sample
/ED/ED8/Script_ED8/.git/hooks/fsmonitor-watchman.sample
/ED/ED8/Script_ED8/.git/hooks/pre-rebase.sample
/ED/ED8/Script_ED8/.git/hooks/pre-commit.sample
/ED/ED8/Script_ED8/.git/hooks/pre-receive.sample
/ED/ED8/Script_ED8/.git/hooks/post-update.sample
/ED/ED8/Script_ED8/.git/hooks/commit-msg.sample
/ED/ED8/Script_ED8/.git/hooks/pre-applypatch.sample
/ED/ED8/Script_ED8/ED8restore_from_local-mysql.sh
/ED/ED8/Script_ED8/02.AutoBackup_crontab_check.sh
/ED/ED8/Script_ED8/ED8restore_from_local-mysql.sh.TMP
Pass. tar Script_ED8 file OK.
Pass. Make a copy file to "/ED/ED8/Backup_file". Finished!
Pass. Copied to BAK_Disk_A. 
===== 2019/08/08 01:59:40 ===== ./ED8backup-Script_ED8-Auto.sh =====
Pass. Backup file saving folder: /ED/ED8/Backup_file exist, go next.
Pass. tar Script_ED8 file OK.
Pass. Make a copy file to "/ED/ED8/Backup_file". Finished!
Pass. Copied to BAK_Disk_A. 
===== 2019/08/08 02:00:11 ===== ./ED8backup-Script_ED8-Auto.sh =====
Pass. Backup file saving folder: /ED/ED8/Backup_file exist, go next.
Pass. tar Script_ED8 file OK.
Pass. Make a copy file to "/ED/ED8/Backup_file". Finished!
Pass. Copied to BAK_Disk_A. 
===== 2019/08/08 02:00:59 ===== ./ED8backup-Script_ED8-Auto.sh =====
Pass. Backup file saving folder: /ED/ED8/Backup_file exist, go next.
Pass. tar Script_ED8 file OK.
Pass. Make a copy file to "/ED/ED8/Backup_file". Finished!
Pass. Copied to BAK_Disk_A. 
===== 2019/08/08 02:18:10 ===== ./ED8backup-Script_ED8-Auto.sh =====
Start backup the Script_ED8 
Pass. Backup file saving folder: /ED/ED8/Backup_file exist, go next.
Pass. tar Script_ED8 file OK.
Pass. Make a copy file to "/ED/ED8/Backup_file". Finished!

Start backup the Script_ED8 to BAK_Disk_A 
Pass. Copied to BAK_Disk_A. 


+ 0
- 489
_LOG/ED8backup-mysql-Auto.log Datei anzeigen

@@ -1,489 +0,0 @@
===== 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) 
===== 2019/08/08 01:57:01 ===== ./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-20190808-015701.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-20190808-015701.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-20190808-015701.gz) 
===== 2019/08/09 01:28:02 ===== /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.
==========================================================================================
 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-20190809-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-20190809-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-20190809-012801.gz) 

+ 0
- 20
_LOG/ED8restore_from_local-mysql.log Datei anzeigen

@@ -1,20 +0,0 @@
======= 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.


Laden…
Abbrechen
Speichern