From bf551a5b9facb4fdad8f65445f44fd1e4206f05d Mon Sep 17 00:00:00 2001 From: deajan Date: Thu, 11 Jul 2013 19:20:57 +0200 Subject: [PATCH] Fixed an error if destination not present. Also fixed remote host ping still tries to ping even if remote_backup is disabled. --- obackup.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/obackup.sh b/obackup.sh index 7a89859..46764f4 100755 --- a/obackup.sh +++ b/obackup.sh @@ -2,8 +2,8 @@ ###### Remote (or local) backup script for files & databases ###### (L) 2013 by Ozy de Jong (www.badministrateur.com) -OBACKUP_VERSION=1.83 -OBACKUP_BUILD=2306201301 +OBACKUP_VERSION=1.84 +OBACKUP_BUILD=0807201301 DEBUG=no SCRIPT_PID=$$ @@ -413,6 +413,7 @@ function CheckSpaceRequirements LogError "Local disk space may be insufficient to backup files (available space is lower than non compressed databases)." fi else + LOCAL_SQL_SPACE=0 LogError "SQL storage path [$LOCAL_SQL_STORAGE] doesn't exist." fi fi @@ -438,6 +439,7 @@ function CheckSpaceRequirements LogError "Local disk space may be insufficient to backup files (available space is lower than full backup)." fi else + LOCAL_FILE_SPACE=0 LogError "File storage path [$LOCAL_FILE_STORAGE] doesn't exist." fi fi @@ -479,7 +481,7 @@ function CheckTotalExecutionTime function CheckConnectivityRemoteHost { - if [ "$REMOTE_HOST_PING" != "no" ] + if [ "$REMOTE_HOST_PING" != "no" ] && [ "$REMOTE_BACKUP" != "no" ] then ping $REMOTE_HOST -c 2 > /dev/null 2>&1 if [ $? != 0 ] @@ -529,7 +531,7 @@ function ListDatabases $(which ssh) $SSH_COMP -i $SSH_RSA_PRIVATE_KEY $REMOTE_USER@$REMOTE_HOST -p $REMOTE_PORT "mysql -u $SQL_USER -Bse 'SELECT table_schema, round(sum( data_length + index_length ) / 1024) FROM information_schema.TABLES GROUP by table_schema;'" > /dev/shm/obackup_dblist_$SCRIPT_PID & fi else - mysql -u $SQL_USER -Bse 'SELECT table_schema, round(sum( data_length + index_length ) / 1024) FROM information_schema.TABLES GROUP by table_schema;' > /dev/shm/oback_dblist_$SCRIPT_PID & + mysql -u $SQL_USER -Bse 'SELECT table_schema, round(sum( data_length + index_length ) / 1024) FROM information_schema.TABLES GROUP by table_schema;' > /dev/shm/obackup_dblist_$SCRIPT_PID & fi child_pid=$! WaitForTaskCompletition $child_pid $SOFT_MAX_EXEC_TIME_DB_TASK $HARD_MAX_EXEC_TIME_DB_TASK @@ -917,7 +919,7 @@ function RotateBackups then cp -R "$1/$backup" "$1/$backup.obackup.1" else - mv "$1/backup" "$1/$backup.obackup.1" + mv "$1/$backup" "$1/$backup.obackup.1" fi done }