From d7018d7aece092e62aac2352909702f4aab05f96 Mon Sep 17 00:00:00 2001 From: Christoph Date: Fri, 10 Jun 2022 03:13:06 +0200 Subject: [PATCH] different scripts: add '--max_allowed_packet=128M' to mysqldump command. --- add_missing_columns.sh | 21 +++++++++++++++++++-- add_missing_indices.sh | 21 +++++++++++++++++++-- add_missing_primary-keys.sh | 21 +++++++++++++++++++-- check_encryption_scan_legacy-format | 21 +++++++++++++++++++-- convert_filecache_bigint.sh | 21 +++++++++++++++++++-- restore_nextcloud.sh | 20 ++++++++++++++++++-- 6 files changed, 113 insertions(+), 12 deletions(-) diff --git a/add_missing_columns.sh b/add_missing_columns.sh index 23bddff..d2b6bf8 100755 --- a/add_missing_columns.sh +++ b/add_missing_columns.sh @@ -628,13 +628,30 @@ echo "" # - echononl " Backup MySQL database '$DATABASE_NAME'.." if [[ "$DATABASE_TYPE" = 'mysql' ]]; then - mysqldump $MYSQL_CREDENTIALS --single-transaction $DATABASE_NAME > \ + mysqldump $MYSQL_CREDENTIALS --max_allowed_packet=128M --single-transaction $DATABASE_NAME > \ ${WEB_BASE_DIR}/${DATABASE_NAME}-v${CURRENT_VERSION}.${backup_date}.sql 2> $log_file if [[ $? -eq 0 ]]; then echo_ok else echo_failed - fatal "$(cat $log_file)" + + blank_line + echo -e "\t[ \033[33m\033[1mCommand\033[m ]: \033[37m\033[1mmysqldump $MYSQL_CREDENTIALS \\ +\t --max_allowed_packet=128M --single-transaction $DATABASE_NAME > \\ +\t ${WEB_BASE_DIR}/${DATABASE_NAME}-v${PRIOR_VERSION}.${backup_date}.sql\033[m" + + 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 "Abbruch durch User" + blank_line + fi elif [[ "$DATABASE_TYPE" = 'postgres' ]]; then PGPASSWORD=$PSQL_PASS \ diff --git a/add_missing_indices.sh b/add_missing_indices.sh index 5ea4353..38dfcd4 100755 --- a/add_missing_indices.sh +++ b/add_missing_indices.sh @@ -628,13 +628,30 @@ echo "" # - echononl " Backup MySQL database '$DATABASE_NAME'.." if [[ "$DATABASE_TYPE" = 'mysql' ]]; then - mysqldump $MYSQL_CREDENTIALS --opt $DATABASE_NAME > \ + mysqldump $MYSQL_CREDENTIALS --max_allowed_packet=128M --single-transaction $DATABASE_NAME > \ ${WEB_BASE_DIR}/${DATABASE_NAME}-v${CURRENT_VERSION}.${backup_date}.sql 2> $log_file if [[ $? -eq 0 ]]; then echo_ok else echo_failed - fatal "$(cat $log_file)" + + blank_line + echo -e "\t[ \033[33m\033[1mCommand\033[m ]: \033[37m\033[1mmysqldump $MYSQL_CREDENTIALS \\ +\t --max_allowed_packet=128M --single-transaction $DATABASE_NAME > \\ +\t ${WEB_BASE_DIR}/${DATABASE_NAME}-v${PRIOR_VERSION}.${backup_date}.sql\033[m" + + 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 "Abbruch durch User" + blank_line + fi elif [[ "$DATABASE_TYPE" = 'postgres' ]]; then PGPASSWORD=$PSQL_PASS \ diff --git a/add_missing_primary-keys.sh b/add_missing_primary-keys.sh index d6ac2a9..bbd3fa6 100755 --- a/add_missing_primary-keys.sh +++ b/add_missing_primary-keys.sh @@ -628,13 +628,30 @@ echo "" # - echononl " Backup MySQL database '$DATABASE_NAME'.." if [[ "$DATABASE_TYPE" = 'mysql' ]]; then - mysqldump $MYSQL_CREDENTIALS --opt $DATABASE_NAME > \ + mysqldump $MYSQL_CREDENTIALS --max_allowed_packet=128M --single-transaction $DATABASE_NAME > \ ${WEB_BASE_DIR}/${DATABASE_NAME}-v${CURRENT_VERSION}.${backup_date}.sql 2> $log_file if [[ $? -eq 0 ]]; then echo_ok else echo_failed - fatal "$(cat $log_file)" + + blank_line + echo -e "\t[ \033[33m\033[1mCommand\033[m ]: \033[37m\033[1mmysqldump $MYSQL_CREDENTIALS \\ +\t --max_allowed_packet=128M --single-transaction $DATABASE_NAME > \\ +\t ${WEB_BASE_DIR}/${DATABASE_NAME}-v${PRIOR_VERSION}.${backup_date}.sql\033[m" + + 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 "Abbruch durch User" + blank_line + fi elif [[ "$DATABASE_TYPE" = 'postgres' ]]; then PGPASSWORD=$PSQL_PASS \ diff --git a/check_encryption_scan_legacy-format b/check_encryption_scan_legacy-format index 6c0bbee..d0994e3 100755 --- a/check_encryption_scan_legacy-format +++ b/check_encryption_scan_legacy-format @@ -653,13 +653,30 @@ echo "" # - echononl " Backup MySQL database '$DATABASE_NAME'.." if [[ "$DATABASE_TYPE" = 'mysql' ]]; then - mysqldump $MYSQL_CREDENTIALS --opt $DATABASE_NAME > \ + mysqldump $MYSQL_CREDENTIALS --max_allowed_packet=128M --single-transaction $DATABASE_NAME > \ ${WEB_BASE_DIR}/${DATABASE_NAME}-v${CURRENT_VERSION}.${backup_date}.sql 2> $log_file if [[ $? -eq 0 ]]; then echo_ok else echo_failed - fatal "$(cat $log_file)" + + blank_line + echo -e "\t[ \033[33m\033[1mCommand\033[m ]: \033[37m\033[1mmysqldump $MYSQL_CREDENTIALS \\ +\t --max_allowed_packet=128M --single-transaction $DATABASE_NAME > \\ +\t ${WEB_BASE_DIR}/${DATABASE_NAME}-v${PRIOR_VERSION}.${backup_date}.sql\033[m" + + 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 "Abbruch durch User" + blank_line + fi elif [[ "$DATABASE_TYPE" = 'postgres' ]]; then PGPASSWORD=$PSQL_PASS \ diff --git a/convert_filecache_bigint.sh b/convert_filecache_bigint.sh index 9853a29..0ea4eda 100755 --- a/convert_filecache_bigint.sh +++ b/convert_filecache_bigint.sh @@ -653,13 +653,30 @@ echo "" # - echononl " Backup MySQL database '$DATABASE_NAME'.." if [[ "$DATABASE_TYPE" = 'mysql' ]]; then - mysqldump $MYSQL_CREDENTIALS --opt $DATABASE_NAME > \ + mysqldump $MYSQL_CREDENTIALS --max_allowed_packet=128M --single-transaction $DATABASE_NAME > \ ${WEB_BASE_DIR}/${DATABASE_NAME}-v${CURRENT_VERSION}.${backup_date}.sql 2> $log_file if [[ $? -eq 0 ]]; then echo_ok else echo_failed - fatal "$(cat $log_file)" + + blank_line + echo -e "\t[ \033[33m\033[1mCommand\033[m ]: \033[37m\033[1mmysqldump $MYSQL_CREDENTIALS \\ +\t --max_allowed_packet=128M --single-transaction $DATABASE_NAME > \\ +\t ${WEB_BASE_DIR}/${DATABASE_NAME}-v${PRIOR_VERSION}.${backup_date}.sql\033[m" + + 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 "Abbruch durch User" + blank_line + fi elif [[ "$DATABASE_TYPE" = 'postgres' ]]; then PGPASSWORD=$PSQL_PASS \ diff --git a/restore_nextcloud.sh b/restore_nextcloud.sh index 7e5333c..313af09 100755 --- a/restore_nextcloud.sh +++ b/restore_nextcloud.sh @@ -683,13 +683,29 @@ echo "" # - echononl " Backup MySQL database '$DATABASE_NAME'.." if [[ "$DATABASE_TYPE" = 'mysql' ]]; then - mysqldump $MYSQL_CREDENTIALS --opt $DATABASE_NAME > \ + mysqldump $MYSQL_CREDENTIALS --max_allowed_packet=128M --single-transaction $DATABASE_NAME > \ ${WEB_BASE_DIR}/${DATABASE_NAME}-v${CURRENT_VERSION}.${backup_date}.sql 2> $log_file if [[ $? -eq 0 ]]; then echo_ok else echo_failed - fatal "$(cat $log_file)" + + blank_line + echo -e "\t[ \033[33m\033[1mCommand\033[m ]: \033[37m\033[1mmysqldump $MYSQL_CREDENTIALS \\ +\t --max_allowed_packet=128M --single-transaction $DATABASE_NAME > \\ +\t ${WEB_BASE_DIR}/${DATABASE_NAME}-v${PRIOR_VERSION}.${backup_date}.sql\033[m" + + 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 "Abbruch durch User" + blank_line fi elif [[ "$DATABASE_TYPE" = 'postgres' ]]; then PGPASSWORD=$PSQL_PASS \