diff --git a/dev/common_batch.sh b/dev/common_batch.sh index ebd7888..7b05f8e 100755 --- a/dev/common_batch.sh +++ b/dev/common_batch.sh @@ -3,7 +3,7 @@ SUBPROGRAM=[prgname] PROGRAM="$SUBPROGRAM-batch" # Batch program to run osync / obackup instances sequentially and rerun failed ones AUTHOR="(L) 2013-2020 by Orsiris de Jong" CONTACT="http://www.netpower.fr - ozy@netpower.fr" -PROGRAM_BUILD=2019090901 +PROGRAM_BUILD=2020031501 ## Runs an osync /obackup instance for every conf file found ## If an instance fails, run it again if time permits @@ -38,23 +38,7 @@ fi include #### Logger SUBSET #### include #### CleanUp SUBSET #### - -function TrapQuit { - local exitcode=0 - - # Get ERROR / WARN alert flags from subprocesses that call Logger - if [ -f "$RUN_DIR/$PROGRAM.Logger.warn.$SCRIPT_PID.$TSTAMP" ]; then - WARN_ALERT=true - exitcode=2 - fi - if [ -f "$RUN_DIR/$PROGRAM.Logger.error.$SCRIPT_PID.$TSTAMP" ]; then - ERROR_ALERT=true - exitcode=1 - fi - - CleanUp - exit $exitcode -} +include #### TrapQuit SUBSET #### function CheckEnvironment { ## osync / obackup executable full path can be set here if it cannot be found on the system diff --git a/dev/common_install.sh b/dev/common_install.sh index cd1d0e2..6f1b30a 100644 --- a/dev/common_install.sh +++ b/dev/common_install.sh @@ -10,7 +10,7 @@ PROGRAM_BINARY=$PROGRAM".sh" PROGRAM_BATCH=$PROGRAM"-batch.sh" SSH_FILTER="ssh_filter.sh" -SCRIPT_BUILD=2020011001 +SCRIPT_BUILD=2020031501 INSTANCE_ID="installer-$SCRIPT_BUILD" ## osync / obackup / pmocr / zsnap install script @@ -39,6 +39,8 @@ fi include #### UrlEncode SUBSET #### include #### GetLocalOS SUBSET #### include #### GetConfFileValue SUBSET #### +include #### CleanUp SUBSET #### +include #### TrapQuit SUBSET #### function SetLocalOSSettings { USER=root @@ -337,23 +339,6 @@ function Usage { exit 127 } -function TrapQuit { - local exitcode=0 - - # Get ERROR / WARN alert flags from subprocesses that call Logger - if [ -f "$RUN_DIR/$PROGRAM.Logger.warn.$SCRIPT_PID.$TSTAMP" ]; then - WARN_ALERT=true - exitcode=2 - fi - if [ -f "$RUN_DIR/$PROGRAM.Logger.error.$SCRIPT_PID.$TSTAMP" ]; then - ERROR_ALERT=true - exitcode=1 - fi - - CleanUp - exit $exitcode -} - ############################## Script entry point function GetCommandlineArguments { diff --git a/dev/merge.sh b/dev/merge.sh index 724f397..4bc8fa7 100755 --- a/dev/merge.sh +++ b/dev/merge.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -## MERGE 2019022601 +## MERGE 2020031501 ## Merges ofunctions.sh and n_program.sh into program.sh ## Adds installer @@ -61,6 +61,7 @@ function __PREPROCESSOR_Constants { '#### SetConfFileValue SUBSET ####' '#### CheckRFC822 SUBSET ####' '#### CleanUp SUBSET ####' + '#### TrapQuit SUBSET ####' '#### FileMove SUBSET ####' ) } diff --git a/dev/ofunctions.sh b/dev/ofunctions.sh index 838c5c6..dbd48d1 100644 --- a/dev/ofunctions.sh +++ b/dev/ofunctions.sh @@ -30,8 +30,8 @@ #### OFUNCTIONS FULL SUBSET #### #### OFUNCTIONS MINI SUBSET #### #### OFUNCTIONS MICRO SUBSET #### -_OFUNCTIONS_VERSION=2.3.0-RC3 -_OFUNCTIONS_BUILD=2019122501 +_OFUNCTIONS_VERSION=2.3.0-RC4 +_OFUNCTIONS_BUILD=2020031501 #### _OFUNCTIONS_BOOTSTRAP SUBSET #### _OFUNCTIONS_BOOTSTRAP=true #### _OFUNCTIONS_BOOTSTRAP SUBSET END #### @@ -421,6 +421,26 @@ function KillAllChilds { return $errorcount } +#### TrapQuit SUBSET #### +function GenericTrapQuit { + local exitcode=0 + + # Get ERROR / WARN alert flags from subprocesses that call Logger + if [ -f "$RUN_DIR/$PROGRAM.Logger.warn.$SCRIPT_PID.$TSTAMP" ]; then + WARN_ALERT=true + exitcode=2 + fi + if [ -f "$RUN_DIR/$PROGRAM.Logger.error.$SCRIPT_PID.$TSTAMP" ]; then + ERROR_ALERT=true + exitcode=1 + fi + + CleanUp + exit $exitcode +} + +#### TrapQuit SUBSET END #### + #### CleanUp SUBSET #### function CleanUp { # Exit controlmaster before it's socket gets deleted @@ -442,23 +462,6 @@ function CleanUp { #### CleanUp SUBSET END #### -function GenericTrapQuit { - local exitcode=0 - - # Get ERROR / WARN alert flags from subprocesses that call Logger - if [ -f "$RUN_DIR/$PROGRAM.Logger.warn.$SCRIPT_PID.$TSTAMP" ]; then - WARN_ALERT=true - exitcode=2 - fi - if [ -f "$RUN_DIR/$PROGRAM.Logger.error.$SCRIPT_PID.$TSTAMP" ]; then - ERROR_ALERT=true - exitcode=1 - fi - - CleanUp - exit $exitcode -} - #### OFUNCTIONS MICRO SUBSET END #### # osync/obackup/pmocr script specific mail alert function, use SendEmail function for generic mail sending