TrapQuit function should exist as subset

pull/194/head
root 4 years ago
parent 98c1b97fb0
commit 8788582f63

@ -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

@ -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 {

@ -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 ####'
)
}

@ -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

Loading…
Cancel
Save