From 290821e949f1e7f9e9a428f85044d3127d0889ba Mon Sep 17 00:00:00 2001 From: deajan Date: Mon, 2 Jan 2017 12:01:58 +0100 Subject: [PATCH] Missing manual database list detection fix --- dev/n_obackup.sh | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/dev/n_obackup.sh b/dev/n_obackup.sh index b3d2350..157e94e 100755 --- a/dev/n_obackup.sh +++ b/dev/n_obackup.sh @@ -10,7 +10,7 @@ PROGRAM="obackup" AUTHOR="(C) 2013-2016 by Orsiris de Jong" CONTACT="http://www.netpower.fr/obackup - ozy@netpower.fr" PROGRAM_VERSION=2.1-dev -PROGRAM_BUILD=2016123101 +PROGRAM_BUILD=2017010201 IS_STABLE=no include #### OFUNCTIONS FULL SUBSET #### @@ -273,6 +273,7 @@ function ListDatabases { local dbName local dbSize local dbBackup + local missingDatabases=false local dbArray @@ -304,24 +305,28 @@ function ListDatabases { while read -r name size; do dbName=$name; dbSize=$size; done <<< "$line" if [ "$DATABASES_ALL" == "yes" ]; then - dbBackup=1 + dbBackup=true IFS=$PATH_SEPARATOR_CHAR read -r -a dbArray <<< "$DATABASES_ALL_EXCLUDE_LIST" for j in "${dbArray[@]}"; do if [ "$dbName" == "$j" ]; then - dbBackup=0 + dbBackup=false fi done else - dbBackup=0 + dbBackup=false IFS=$PATH_SEPARATOR_CHAR read -r -a dbArray <<< "$DATABASES_LIST" for j in "${dbArray[@]}"; do if [ "$dbName" == "$j" ]; then - dbBackup=1 + dbBackup=true fi done + if [ $dbBackup == false ]; then + missingDatabases=true + fi + fi - if [ $dbBackup -eq 1 ]; then + if [ $dbBackup == true ]; then if [ "$SQL_BACKUP_TASKS" != "" ]; then SQL_BACKUP_TASKS="$SQL_BACKUP_TASKS $dbName" else @@ -333,6 +338,15 @@ function ListDatabases { fi done < "$outputFile" + if [ $missingDatabases == true ]; then + IFS=$PATH_SEPARATOR_CHAR read -r -a dbArray <<< "$DATABASES_LIST" + for i in "${dbArray[@]}"; do + if ! grep "$i" "$outputFile" > /dev/null 2>&1; then + Logger "Missing database [$i]." "CRITICAL" + fi + done + fi + Logger "Database backup list: $SQL_BACKUP_TASKS" "DEBUG" Logger "Database exclude list: $SQL_EXCLUDED_TASKS" "DEBUG" else