install_mysql.sh: Stop DB Service befor updating service files (Update Mode).

This commit is contained in:
Christoph 2019-11-14 13:36:53 +01:00
parent c0b888b2bf
commit 4b8c5fbea5

View File

@ -116,6 +116,9 @@ echo_failed(){
echo_skipped() {
echo -e "\033[75G[ \033[33m\033[1mskipped\033[m ]"
}
echo_wait(){
echo -en "\033[75G[ \033[5m\033[1m..\033[m ]"
}
detect_os_1 () {
if $(which lsb_release > /dev/null 2>&1) ; then
@ -2029,6 +2032,7 @@ fi
echononl "Entpacke $distfile ..."
echo_wait
echo "" >> ${logdir}/main.log
echo "## - Entpacke $distfile" >> ${logdir}/main.log
echo "## -" >> ${logdir}/main.log
@ -2169,6 +2173,7 @@ echo "cmake_options=\"$cmake_options\"" >> ${logdir}/main.log
echo_ok
echononl "Konfiguriere MySQL (cmake).."
echo_wait
echo "" >> ${logdir}/main.log
echo "# - Konfiguriere MySQL (cmake).." >> ${logdir}/main.log
echo "# -" >> ${logdir}/main.log
@ -2184,6 +2189,7 @@ else
fi
echononl "Kompiliere MySQL.."
echo_wait
echo "" >> ${logdir}/main.log
echo "## - Kompiliere MySQL" >> ${logdir}/main.log
echo "## -" >> ${logdir}/main.log
@ -2199,6 +2205,7 @@ else
fi
echononl "Installiere MySQL.."
echo_wait
echo "" >> ${logdir}/main.log
echo "## - Installiere MySQL" >> ${logdir}/main.log
echo "## -" >> ${logdir}/main.log
@ -4948,6 +4955,81 @@ else
fi
if $UPDATE_MYSQL && ! $PARALLEL_INSTALLATION ; then
## -----
## - Stoppe MySQL Datenbank Service
## -----
echo ""
echo ""
echo -e "\033[37m\033[1mStoppe MySQL Datenbank Service\033[m"
echo ""
echo "" >> ${logdir}/main.log
echo "" >> ${logdir}/main.log
echo "## -----" >> ${logdir}/main.log
echo "## - Stoppe MySQL Datenbank Service" >> ${logdir}/main.log
echo "## -----" >> ${logdir}/main.log
echononl "Stoppe MySQL Datenbankserver.."
echo "" >> ${logdir}/main.log
echo "## - Stoppe MySQL Datenbankserver" >> ${logdir}/main.log
echo "## -" >> ${logdir}/main.log
if $INSTALL_SYSTEMD_SERVICE ; then
echo "systemctl stop \"$MYSQL_SERVICE_FILE\"" >> ${logdir}/main.log
systemctl stop "$MYSQL_SERVICE_FILE" >> ${logdir}/main.log 2>&1
if [[ $? -eq 0 ]]; then
echo_ok
else
echo_failed
error Konnte MySQL Datenbankserver nicht stoppen..
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/nno]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
else
if $SYSTEMD_EXISTS ; then
echo "systemctl stop ${MYSQL_SYSV_INIT_SCRIPT}" >> ${logdir}/main.log
systemctl stop ${MYSQL_SYSV_INIT_SCRIPT} >> ${logdir}/main.log 2>&1
else
echo "/etc/init.d/${MYSQL_SYSV_INIT_SCRIPT} stop" >> ${logdir}/main.log
/etc/init.d/${MYSQL_SYSV_INIT_SCRIPT} stop >> ${logdir}/main.log 2>&1
fi
if [ "$?" = "0" ]; then
echo_ok
else
echo_failed
error Konnte MySQL Datenbankserver nicht stoppen..
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/nno]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
fi
echononl "Sleep for 5 seconds.."
echo_wait
sleep 5
echo_ok
echo ""
fi
if $INSTALL_SYSTEMD_SERVICE ; then
echononl "Kopiere Service File nach '/etc/systemd/system'.."
@ -5269,7 +5351,11 @@ else
fi
fi
sleep 2
echononl "Sleep for 5 seconds.."
echo_wait
sleep 5
echo_ok
@ -5580,6 +5666,7 @@ else
## - Run mysql_upgrade
## -
echononl "Run 'mysql_upgrade -uroot' - this may take some (long) time.."
echo_wait
echo "" >> ${logdir}/main.log
echo "## - Run 'mysql_upgrade -uroot' - this may take some (long) time" >> ${logdir}/main.log
echo "## -" >> ${logdir}/main.log