diff --git a/CHANGELOG.md b/CHANGELOG.md index 53f4f27..8fbed30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ KNOWN ISSUES RECENT CHANGES -------------- +- Improved forced quit command by killing all child processes +- Before / after commands are now ignored on dryruns - Improved verbose output - Fixed various typos - Enforced CheckConnectivityRemoteHost and CheckConnectivity3rdPartyHosts checks (if one of these fails, osync is stopped) diff --git a/osync.sh b/osync.sh index 8d6a1e5..6c1d80f 100755 --- a/osync.sh +++ b/osync.sh @@ -77,6 +77,9 @@ function TrapStop function TrapQuit { + ## Stopping all running child processes + pkill -TERM -P $$ + if [ $error_alert -ne 0 ] then SendAlert @@ -310,7 +313,11 @@ function WaitForCompletion ## Runs local command $1 and waits for completition in $2 seconds function RunLocalCommand { - CheckConnectivity3rdPartyHosts + if [ $dryrun -ne 0 ] + then + Log "Dryrun: Local command [$1] not run." + return 1 + fi $1 > /dev/shm/osync_run_local_$SCRIPT_PID 2>&1 & child_pid=$! WaitForTaskCompletion $child_pid 0 $2 @@ -333,6 +340,11 @@ function RunRemoteCommand { CheckConnectivity3rdPartyHosts CheckConnectivityRemoteHost + if [ $dryrun -ne 0 ] + then + Log "Dryrun: Local command [$1] not run." + return 1 + fi eval "$SSH_CMD \"$1\" > /dev/shm/osync_run_remote_$SCRIPT_PID 2>&1 &" child_pid=$! WaitForTaskCompletion $child_pid 0 $2