From 3dd8e456c0aca54ba6ce1797a6cfc6a69d668820 Mon Sep 17 00:00:00 2001 From: deajan Date: Mon, 15 Jul 2013 21:53:08 +0200 Subject: [PATCH 1/3] Updated website link. Also removed duplicate exit statement after Usage function run. --- obackup.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/obackup.sh b/obackup.sh index 10b9221..c490647 100755 --- a/obackup.sh +++ b/obackup.sh @@ -1,7 +1,7 @@ #!/bin/bash ###### Remote (or local) backup script for files & databases -###### (L) 2013 by Ozy de Jong (www.badministrateur.com) +###### (L) 2013 by Orsiris "Ozy" de Jong (www.netpower.fr) OBACKUP_VERSION=1.84 OBACKUP_BUILD=1107201301 @@ -1028,7 +1028,6 @@ silent=0 if [ $# -eq 0 ] then Usage - exit fi for i in "$@" @@ -1042,7 +1041,6 @@ do ;; --help|-h) Usage - exit ;; esac done From 61cf6d4d2b4ca088407aa5e482907ed16aaffd2e Mon Sep 17 00:00:00 2001 From: deajan Date: Mon, 15 Jul 2013 22:33:49 +0200 Subject: [PATCH 2/3] Fixed exit code. --- obackup.sh | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/obackup.sh b/obackup.sh index c490647..354ceb3 100755 --- a/obackup.sh +++ b/obackup.sh @@ -1069,12 +1069,6 @@ then RunAfterHook fi CleanUp - if [ $error_alert -ne 0 ] - then - exit 1 - else - exit 0 - fi else LogError "Configuration file could not be loaded." exit 1 @@ -1089,6 +1083,8 @@ if [ $error_alert -ne 0 ] then SendAlert LogError "Backup script finished with errors." + exit 1 else Log "Backup script finshed." + exit 0 fi From 5d2494d7a7562b8e469481b7e1635e8bd0c44550 Mon Sep 17 00:00:00 2001 From: deajan Date: Mon, 15 Jul 2013 22:35:24 +0200 Subject: [PATCH 3/3] Code cleanup --- obackup.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/obackup.sh b/obackup.sh index 354ceb3..3afad00 100755 --- a/obackup.sh +++ b/obackup.sh @@ -36,10 +36,6 @@ TOTAL_FILES_SIZE=0 # Total file size of $DIRECTORIES_TO_BACKUP # /dev/shm/obackup_run_local_$SCRIPT_PID Output of command to be run localy # /dev/shm/obackup_run_remote_$SCRIPT_PID Output of command to be run remotely -# Alert flags -soft_alert_total=0 -error_alert=0 - function Log { echo "TIME: $SECONDS - $1" >> "$LOG_FILE" @@ -1024,6 +1020,9 @@ function Usage # Command line argument flags dryrun=0 silent=0 +# Alert flags +soft_alert_total=0 +error_alert=0 if [ $# -eq 0 ] then @@ -1077,6 +1076,8 @@ then LogError "No configuration file provided." exit 1 fi +else + LogError "Environment not suitable to run obackup." fi if [ $error_alert -ne 0 ]