restore_nextcloud.sh: minor changes on script output

This commit is contained in:
Christoph 2021-02-06 10:37:30 +01:00
parent e64364b0b4
commit 74115ac714

View File

@ -95,6 +95,11 @@ echo_skipped() {
echo " [ skipped ]"
fi
}
echo_wait(){
if $terminal ; then
echo -en "\033[75G[ \033[5m\033[1m...\033[m ]"
fi
}
fatal (){
echo ""
echo ""
@ -424,6 +429,31 @@ echo ""
DATA_DIR=${WEB_BASE_DIR}/data-${VERSION}
INSTALL_DIR=${WEB_BASE_DIR}/nextcloud-${VERSION}
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 < \
# ${WEB_BASE_DIR}/${DATABASE_NAME}-v${RESTORE_VERSION}.${DATE_RESTORE_VERSION}.sql 2> $log_file
sleep 10
if [[ $? -eq 0 ]]; then
echo_ok
else
echo_failed
fatal "$(cat $log_file)"
fi
elif [[ "$DATABASE_TYPE" = 'postgres' ]]; then
PGPASSWORD=$PSQL_PASS \
pg_dump $DATABASE_NAME -h $PSQL_SERVER -U $PSQL_USER \
-f ${WEB_BASE_DIR}/${DATABASE_NAME}-v${RESTORE_VERSION}.${DATE_RESTORE_VERSION}.sql 2> $log_file
if [[ $? -eq 0 ]]; then
echo_ok
else
echo_failed
fatal "$(cat $log_file)"
fi
fi
clean_up 0
# - Deaktiviere Cronjobs
# -
_backup_crontab_file=/tmp/crontab_root.${backup_date}
@ -655,7 +685,8 @@ fi
# - Restore Database
# -
echononl " Restore Database"
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 < \
${WEB_BASE_DIR}/${DATABASE_NAME}-v${RESTORE_VERSION}.${DATE_RESTORE_VERSION}.sql 2> $log_file