From 696e41dcb8696792653e998d98f94e228166967b Mon Sep 17 00:00:00 2001 From: Orsiris de Jong Date: Wed, 11 Sep 2013 16:23:57 +0200 Subject: [PATCH] Added STOP_ON_CMD_ERROR function --- osync.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/osync.sh b/osync.sh index 2f42a56..90d5306 100755 --- a/osync.sh +++ b/osync.sh @@ -3,7 +3,7 @@ ###### Osync - Rsync based two way sync engine with fault tolerance ###### (L) 2013 by Orsiris "Ozy" de Jong (www.netpower.fr) OSYNC_VERSION=0.99preRC2 -OSYNC_BUILD=1009201301 +OSYNC_BUILD=1109201301 DEBUG=no SCRIPT_PID=$$ @@ -325,13 +325,18 @@ function RunLocalCommand then Log "Running command [$1] on local host succeded." else - Log "Running command [$1] on local host failed." + LogError "Running command [$1] on local host failed." fi if [ $verbose -eq 1 ] then Log "Command output:\n$(cat /dev/shm/osync_run_local_$SCRIPT_PID)" fi + + if [ "$STOP_ON_CMD_ERROR" == "yes" ] + then + exit 1 + fi } ## Runs remote command $1 and waits for completition in $2 seconds @@ -359,6 +364,11 @@ function RunRemoteCommand then Log "Command output:\n$(cat /dev/shm/osync_run_remote_$SCRIPT_PID)" fi + + if [ "$STOP_ON_CMD_ERROR" == "yes" ] + then + exit 1 + fi } function RunBeforeHook