Work on WaitForTaskCompletion hard exec time
This commit is contained in:
parent
8500bfa5d9
commit
8ee4b824da
|
@ -1,6 +1,6 @@
|
||||||
#### MINIMAL-FUNCTION-SET BEGIN ####
|
#### MINIMAL-FUNCTION-SET BEGIN ####
|
||||||
|
|
||||||
## FUNC_BUILD=2016112401
|
## FUNC_BUILD=2016112501
|
||||||
## BEGIN Generic bash functions written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr
|
## BEGIN Generic bash functions written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr
|
||||||
|
|
||||||
## To use in a program, define the following variables:
|
## To use in a program, define the following variables:
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
## When called from subprocesses, variable of main process can't be set. Status needs to be get via $RUN_DIR/$PROGRAM.Logger.{error|warn}.$SCRIPT_PID
|
## When called from subprocesses, variable of main process can't be set. Status needs to be get via $RUN_DIR/$PROGRAM.Logger.{error|warn}.$SCRIPT_PID
|
||||||
|
|
||||||
|
|
||||||
|
# TODO: WaitForTaskCompletion and ParallelExec both need exit codes on hard_max_exec_time
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -61,16 +61,16 @@ fi #__WITH_PARANOIA_DEBUG
|
||||||
## allow debugging from command line with _DEBUG=yes
|
## allow debugging from command line with _DEBUG=yes
|
||||||
if [ ! "$_DEBUG" == "yes" ]; then
|
if [ ! "$_DEBUG" == "yes" ]; then
|
||||||
_DEBUG=no
|
_DEBUG=no
|
||||||
SLEEP_TIME=.05
|
|
||||||
_LOGGER_VERBOSE=false
|
_LOGGER_VERBOSE=false
|
||||||
else
|
else
|
||||||
if [ "$SLEEP_TIME" == "" ]; then # Leave the possibity to set SLEEP_TIME as environment variable when runinng with bash -x in order to avoid spamming console
|
|
||||||
SLEEP_TIME=.05
|
|
||||||
fi
|
|
||||||
trap 'TrapError ${LINENO} $?' ERR
|
trap 'TrapError ${LINENO} $?' ERR
|
||||||
_LOGGER_VERBOSE=true
|
_LOGGER_VERBOSE=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$SLEEP_TIME" == "" ]; then # Leave the possibity to set SLEEP_TIME as environment variable when runinng with bash -x in order to avoid spamming console
|
||||||
|
SLEEP_TIME=.05
|
||||||
|
fi
|
||||||
|
|
||||||
SCRIPT_PID=$$
|
SCRIPT_PID=$$
|
||||||
|
|
||||||
LOCAL_USER=$(whoami)
|
LOCAL_USER=$(whoami)
|
||||||
|
@ -663,6 +663,8 @@ function WaitForTaskCompletion {
|
||||||
if [ $noError != true ]; then
|
if [ $noError != true ]; then
|
||||||
SendAlert true
|
SendAlert true
|
||||||
fi
|
fi
|
||||||
|
#TODO: add exit flag when max exec time is reached
|
||||||
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1320,10 +1322,6 @@ function __CheckArguments {
|
||||||
local minArgs
|
local minArgs
|
||||||
local maxArgs
|
local maxArgs
|
||||||
|
|
||||||
if [ "$_PARANOIA_DEBUG" == "yes" ]; then
|
|
||||||
Logger "Entering function [$functionName]." "DEBUG"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# All arguments of the function to check are passed as array in ${4} (the function call waits for $@)
|
# All arguments of the function to check are passed as array in ${4} (the function call waits for $@)
|
||||||
# If any of the arguments contains spaces, bash things there are two aguments
|
# If any of the arguments contains spaces, bash things there are two aguments
|
||||||
# In order to avoid this, we need to iterate over ${4} and count
|
# In order to avoid this, we need to iterate over ${4} and count
|
||||||
|
@ -1338,22 +1336,29 @@ function __CheckArguments {
|
||||||
if [ "$argument" = "" ]; then
|
if [ "$argument" = "" ]; then
|
||||||
fetchArguments=false
|
fetchArguments=false
|
||||||
else
|
else
|
||||||
argList="$arg_list [Argument $(($iterate-3)): $argument]"
|
argList="$argList[Argument $(($iterate-3)): $argument] "
|
||||||
iterate=$(($iterate+1))
|
iterate=$(($iterate+1))
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
countedArguments=$((iterate-4))
|
countedArguments=$((iterate-4))
|
||||||
|
|
||||||
if [ $(IsNumeric "$numberOfArguments") -eq 1 ]; then
|
if [ $(IsInteger "$numberOfArguments") -eq 1 ]; then
|
||||||
minArgs=$numberOfArguments
|
minArgs=$numberOfArguments
|
||||||
maxArgs=$numberOfArguments
|
maxArgs=$numberOfArguments
|
||||||
else
|
else
|
||||||
IFS='-' read minArgs maxArgs <<< "$numberOfArguments"
|
IFS='-' read minArgs maxArgs <<< "$numberOfArguments"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$_PARANOIA_DEBUG" == "yes" ]; then
|
||||||
|
Logger "Entering function [$functionName]." "DEBUG"
|
||||||
|
fi
|
||||||
|
|
||||||
if ! ([ $countedArguments -ge $minArgs ] && [ $countedArguments -le $maxArgs ]); then
|
if ! ([ $countedArguments -ge $minArgs ] && [ $countedArguments -le $maxArgs ]); then
|
||||||
Logger "Function $functionName may have inconsistent number of arguments. Expected min: $minArgs, max: $maxArgs, count: $countedArguments, bash seen: $numberOfGivenArguments. see log file." "ERROR"
|
Logger "Function $functionName may have inconsistent number of arguments. Expected min: $minArgs, max: $maxArgs, count: $countedArguments, bash seen: $numberOfGivenArguments. see log file." "ERROR"
|
||||||
Logger "Arguments passed: $argList" "ERROR"
|
Logger "Arguments passed: $argList" "ERROR"
|
||||||
|
else
|
||||||
|
Logger "Arguments passed: $argList" "VERBOSE"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue