Some post installations on update and restore scripts.

This commit is contained in:
2023-08-03 10:43:06 +02:00
parent d84294cf0b
commit 2c37b04ddf
3 changed files with 277 additions and 17 deletions

View File

@ -100,7 +100,7 @@ echo_skipped() {
}
echo_wait(){
if $terminal ; then
echo -en "\033[75G[ \033[5m\033[1m...\033[m ]"
echo -en "\033[75G[ \033[5m\033[1m..\033[m ]"
fi
}
fatal (){
@ -727,7 +727,7 @@ fi
# - Restore Database
# -
echononl " Restore Database - \033[5m\033[1mmay take a long time\033[m"
echononl " Restore Database \033[5m\033[1mmay take a long time\033[m"
echo_wait
if [[ "$DATABASE_TYPE" = 'mysql' ]]; then
mysql $MYSQL_CREDENTIALS $DATABASE_NAME < \
@ -784,8 +784,90 @@ fi
echo ""
echo ""
echo -e "\033[37m\033[1mDoing some post-script tasks..\033[m"
echo ""
# - Add missing columns
# -
echononl " Add missing columns .."
su -c "${PHP_BIN} ${WEB_BASE_DIR}/htdocs/occ db:add-missing-columns" -s /bin/bash $HTTP_USER > $log_file 2>&1
if [[ $? -eq 0 ]]; then
echo_ok
else
echo_failed
error "$(cat $log_file)"
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/no]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Interrupted by user."
fi
# - Create missing indices
# -
echononl " Add missing indices .."
su -c "${PHP_BIN} ${WEB_BASE_DIR}/htdocs/occ db:add-missing-indices" -s /bin/bash $HTTP_USER > $log_file 2>&1
if [[ $? -eq 0 ]]; then
echo_ok
else
echo_failed
error "$(cat $log_file)"
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/no]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Interrupted by user."
fi
# - Add missing primary keys ..
# -
echononl " Add missing primary keys .."
su -c "${PHP_BIN} ${WEB_BASE_DIR}/htdocs/occ db:add-missing-primary-keys" -s /bin/bash $HTTP_USER > $log_file 2>&1
if [[ $? -eq 0 ]]; then
echo_ok
else
echo_failed
error "$(cat $log_file)"
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/no]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Interrupted by user."
fi
echononl " Run cronjob manually.."
su -c "${PHP_BIN} ${WEB_BASE_DIR}/htdocs/cron.php" -s /bin/bash $HTTP_USER > $log_file 2>&1
if [[ $? -eq 0 ]]; then
echo_ok
else
echo_failed
error "$(cat $log_file)"
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/no]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Interrupted by user."
fi
blank_line
echononl " Restart PHP engine.."
if [[ "$PHP_ENGINE" = "FPM" ]]; then
if $SYSTEMD_EXISTS ; then