Added missing TrapQuit function
This commit is contained in:
parent
8b757bf083
commit
a7526c8a87
|
@ -1,9 +1,9 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
SUBPROGRAM=[prgname]
|
SUBPROGRAM=[prgname]
|
||||||
PROGRAM="$SUBPROGRAM-batch" # Batch program to run osync / obackup instances sequentially and rerun failed ones
|
PROGRAM="$SUBPROGRAM-batch" # Batch program to run osync / obackup instances sequentially and rerun failed ones
|
||||||
AUTHOR="(L) 2013-2018 by Orsiris de Jong"
|
AUTHOR="(L) 2013-2019 by Orsiris de Jong"
|
||||||
CONTACT="http://www.netpower.fr - ozy@netpower.fr"
|
CONTACT="http://www.netpower.fr - ozy@netpower.fr"
|
||||||
PROGRAM_BUILD=2018100201
|
PROGRAM_BUILD=2019090901
|
||||||
|
|
||||||
## Runs an osync /obackup instance for every conf file found
|
## Runs an osync /obackup instance for every conf file found
|
||||||
## If an instance fails, run it again if time permits
|
## If an instance fails, run it again if time permits
|
||||||
|
@ -34,13 +34,27 @@ elif [ -w /var/tmp ]; then
|
||||||
else
|
else
|
||||||
RUN_DIR=.
|
RUN_DIR=.
|
||||||
fi
|
fi
|
||||||
|
|
||||||
trap TrapQuit TERM EXIT HUP QUIT
|
|
||||||
|
|
||||||
# No need to edit under this line ##############################################################
|
# No need to edit under this line ##############################################################
|
||||||
|
|
||||||
include #### Logger SUBSET ####
|
include #### Logger 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
|
||||||
|
}
|
||||||
|
|
||||||
function CheckEnvironment {
|
function CheckEnvironment {
|
||||||
## osync / obackup executable full path can be set here if it cannot be found on the system
|
## osync / obackup executable full path can be set here if it cannot be found on the system
|
||||||
if ! type $SUBPROGRAM.sh > /dev/null 2>&1
|
if ! type $SUBPROGRAM.sh > /dev/null 2>&1
|
||||||
|
@ -129,6 +143,8 @@ function Usage {
|
||||||
exit 128
|
exit 128
|
||||||
}
|
}
|
||||||
|
|
||||||
|
trap TrapQuit TERM EXIT HUP QUIT
|
||||||
|
|
||||||
opts=""
|
opts=""
|
||||||
for i in "$@"
|
for i in "$@"
|
||||||
do
|
do
|
||||||
|
|
Loading…
Reference in New Issue