##### Function Name Is parallel #__WITH_PARANOIA_DEBUG
# GetLocalOS no #__WITH_PARANOIA_DEBUG
@ -44,16 +41,10 @@ IS_STABLE=no
# UnlockReplicas yes #__WITH_PARANOIA_DEBUG
# CleanUp no #__WITH_PARANOIA_DEBUG
#TODO: ExecTasks postponed arrays / files grow a lot. Consider having them "rolling"
#command line arguments don't take -AaqV for example
_OFUNCTIONS_VERSION=2.3.0-dev
_OFUNCTIONS_BUILD=2018062504
_OFUNCTIONS_VERSION=2.3.0-beta1
_OFUNCTIONS_BUILD=2018080801
_OFUNCTIONS_BOOTSTRAP=true
## BEGIN Generic bash functions written in 2013-2017 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr
## To use in a program, define the following variables:
## PROGRAM=program-name
## INSTANCE_ID=program-instance-name
@ -63,8 +54,6 @@ _OFUNCTIONS_BOOTSTRAP=true
## _LOGGER_ERR_ONLY=true/false
## _LOGGER_PREFIX="date"/"time"/""
#TODO: global WAIT_FOR_TASK_COMPLETION_id instead of callerName has to be backported to ParallelExec and osync / obackup / pmocr ocde
## Logger sets {ERROR|WARN}_ALERT variable when called with critical / error / warn loglevel
## When called from subprocesses, variable of main process cannot be set. Status needs to be get via $RUN_DIR/$PROGRAM.Logger.{error|warn}.$SCRIPT_PID.$TSTAMP
@ -252,7 +241,7 @@ function RemoteLogger {
fi
return
elif["$level"=="ERROR"];then
_Logger """$prefix\e[91m$value\e[0m" true
_Logger """$prefix\e[31m$value\e[0m" true
if[$_DEBUG=="yes"];then
_Logger -e """[$retval] in [$(joinString , ${FUNCNAME[@]})] SP=$SCRIPT_PID P=$$" true
fi
@ -389,7 +378,6 @@ function KillChilds {
fi
ifkill -0 "$pid" > /dev/null 2>&1;then
#TODO: Warning: pgrep is not native on cygwin, have this checked in CheckEnvironment
Logger "${FUNCNAME[0]} called by [$id] finished monitoring pid [$pid] with exitcode [$retval].""DEBUG"#TODO: set this to debug in order to stop complaints
Logger "${FUNCNAME[0]} called by [$id] finished monitoring pid [$pid] with exitcode [$retval].""DEBUG"
if["$functionMode"=="ParallelExec"];then
Logger "Command was [${commandsArrayPid[$pid]}].""ERROR"
fi
@ -1280,6 +1279,13 @@ function EscapeSpaces {
echo"${string// /\\}"
}
# Usage var=$(EscapeDoubleQuotes "$var") or var="$(EscapeDoubleQuotes "$var")"
function EscapeDoubleQuotes {
localvalue="${1}"
echo"${value//\"/\\\"}"
}
function IsNumericExpand {
eval"local value=\"${1}\""# Needed eval so variable variables can be processed
@ -1368,6 +1374,8 @@ function CheckRFC822 {
function UrlEncode {
locallength="${#1}"
local i
localLANG=C
for i in $(seq 0$((length-1)));do
localc="${1:i:1}"
@ -1644,6 +1652,9 @@ GetOs
ENDSSH
if[$? !=0];then
Logger "Cannot connect to remote system [$REMOTE_HOST] port [$REMOTE_PORT].""CRITICAL"
@ -2320,7 +2331,7 @@ function WildcardFileExists () {
fi
}
# If using "include" statements, make sure the script does not get executed unless it's loaded by bootstrap
# If using "include" statements, make sure the script does not get executed unless it's loaded by bootstrap.sh which will replace includes with actual code
_OFUNCTIONS_BOOTSTRAP=true
["$_OFUNCTIONS_BOOTSTRAP" !=true]&&echo"Please use bootstrap.sh to load this dev version of $(basename $0)"&&exit1
@ -2678,7 +2689,7 @@ function RemoteLogger {
fi
return
elif["$level"=="ERROR"];then
_Logger """$prefix\e[91m$value\e[0m" true
_Logger """$prefix\e[31m$value\e[0m" true
if[$_DEBUG=="yes"];then
_Logger -e """[$retval] in [$(joinString , ${FUNCNAME[@]})] SP=$SCRIPT_PID P=$$" true
# Mac fswatch doesn't have timeout switch, replacing wait $! with WaitForTaskCompletion without warning nor spinner and increased SLEEP_TIME to avoid cpu hogging. This sims wait $! with timeout
#TODO: ExecTasks postponed arrays / files grow a lot. Consider having them "rolling"
#command line arguments don't take -AaqV for example
_OFUNCTIONS_VERSION=2.3.0-dev
_OFUNCTIONS_BUILD=2018062504
_OFUNCTIONS_VERSION=2.3.0-beta1
_OFUNCTIONS_BUILD=2018080801
_OFUNCTIONS_BOOTSTRAP=true
## BEGIN Generic bash functions written in 2013-2017 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr
## To use in a program, define the following variables:
## PROGRAM=program-name
## INSTANCE_ID=program-instance-name
@ -26,8 +20,6 @@ _OFUNCTIONS_BOOTSTRAP=true
## _LOGGER_ERR_ONLY=true/false
## _LOGGER_PREFIX="date"/"time"/""
#TODO: global WAIT_FOR_TASK_COMPLETION_id instead of callerName has to be backported to ParallelExec and osync / obackup / pmocr ocde
## Logger sets {ERROR|WARN}_ALERT variable when called with critical / error / warn loglevel
## When called from subprocesses, variable of main process cannot be set. Status needs to be get via $RUN_DIR/$PROGRAM.Logger.{error|warn}.$SCRIPT_PID.$TSTAMP
@ -215,7 +207,7 @@ function RemoteLogger {
fi
return
elif["$level"=="ERROR"];then
_Logger """$prefix\e[91m$value\e[0m" true
_Logger """$prefix\e[31m$value\e[0m" true
if[$_DEBUG=="yes"];then
_Logger -e """[$retval] in [$(joinString , ${FUNCNAME[@]})] SP=$SCRIPT_PID P=$$" true
fi
@ -352,7 +344,6 @@ function KillChilds {
fi
ifkill -0 "$pid" > /dev/null 2>&1;then
#TODO: Warning: pgrep is not native on cygwin, have this checked in CheckEnvironment
Logger "${FUNCNAME[0]} called by [$id] finished monitoring pid [$pid] with exitcode [$retval].""DEBUG"#TODO: set this to debug in order to stop complaints
Logger "${FUNCNAME[0]} called by [$id] finished monitoring pid [$pid] with exitcode [$retval].""DEBUG"
if["$functionMode"=="ParallelExec"];then
Logger "Command was [${commandsArrayPid[$pid]}].""ERROR"
fi
@ -1243,6 +1245,13 @@ function EscapeSpaces {
echo"${string// /\\}"
}
# Usage var=$(EscapeDoubleQuotes "$var") or var="$(EscapeDoubleQuotes "$var")"
function EscapeDoubleQuotes {
localvalue="${1}"
echo"${value//\"/\\\"}"
}
function IsNumericExpand {
eval"local value=\"${1}\""# Needed eval so variable variables can be processed
@ -1331,6 +1340,8 @@ function CheckRFC822 {
function UrlEncode {
locallength="${#1}"
local i
localLANG=C
for i in $(seq 0$((length-1)));do
localc="${1:i:1}"
@ -1607,6 +1618,9 @@ GetOs
ENDSSH
if[$? !=0];then
Logger "Cannot connect to remote system [$REMOTE_HOST] port [$REMOTE_PORT].""CRITICAL"
#TODO: ExecTasks postponed arrays / files grow a lot. Consider having them "rolling"
#command line arguments don't take -AaqV for example
_OFUNCTIONS_VERSION=2.3.0-dev
_OFUNCTIONS_BUILD=2018062504
_OFUNCTIONS_VERSION=2.3.0-beta1
_OFUNCTIONS_BUILD=2018080801
_OFUNCTIONS_BOOTSTRAP=true
## BEGIN Generic bash functions written in 2013-2017 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr
## To use in a program, define the following variables:
## PROGRAM=program-name
## INSTANCE_ID=program-instance-name
@ -34,8 +25,6 @@ _OFUNCTIONS_BOOTSTRAP=true
## _LOGGER_ERR_ONLY=true/false
## _LOGGER_PREFIX="date"/"time"/""
#TODO: global WAIT_FOR_TASK_COMPLETION_id instead of callerName has to be backported to ParallelExec and osync / obackup / pmocr ocde
## Logger sets {ERROR|WARN}_ALERT variable when called with critical / error / warn loglevel
## When called from subprocesses, variable of main process cannot be set. Status needs to be get via $RUN_DIR/$PROGRAM.Logger.{error|warn}.$SCRIPT_PID.$TSTAMP
@ -218,7 +207,7 @@ function RemoteLogger {
fi
return
elif["$level"=="ERROR"];then
_Logger """$prefix\e[91m$value\e[0m" true
_Logger """$prefix\e[31m$value\e[0m" true
if[$_DEBUG=="yes"];then
_Logger -e """[$retval] in [$(joinString , ${FUNCNAME[@]})] SP=$SCRIPT_PID P=$$" true
fi
@ -345,7 +334,6 @@ function KillChilds {
fi
ifkill -0 "$pid" > /dev/null 2>&1;then
#TODO: Warning: pgrep is not native on cygwin, have this checked in CheckEnvironment
Logger "${FUNCNAME[0]} called by [$id] finished monitoring pid [$pid] with exitcode [$retval].""DEBUG"#TODO: set this to debug in order to stop complaints
Logger "${FUNCNAME[0]} called by [$id] finished monitoring pid [$pid] with exitcode [$retval].""DEBUG"
if["$functionMode"=="ParallelExec"];then
Logger "Command was [${commandsArrayPid[$pid]}].""ERROR"
fi
@ -1202,6 +1201,13 @@ function EscapeSpaces {
echo"${string// /\\}"
}
# Usage var=$(EscapeDoubleQuotes "$var") or var="$(EscapeDoubleQuotes "$var")"
function EscapeDoubleQuotes {
localvalue="${1}"
echo"${value//\"/\\\"}"
}
function IsNumericExpand {
eval"local value=\"${1}\""# Needed eval so variable variables can be processed
@ -1290,6 +1296,8 @@ function CheckRFC822 {
function UrlEncode {
locallength="${#1}"
local i
localLANG=C
for i in $(seq 0$((length-1)));do
localc="${1:i:1}"
@ -1510,6 +1518,9 @@ GetOs
ENDSSH
if[$? !=0];then
Logger "Cannot connect to remote system [$REMOTE_HOST] port [$REMOTE_PORT].""CRITICAL"
@ -2169,7 +2180,7 @@ function WildcardFileExists () {
fi
}
# If using "include" statements, make sure the script does not get executed unless it's loaded by bootstrap
# If using "include" statements, make sure the script does not get executed unless it's loaded by bootstrap.sh which will replace includes with actual code
_OFUNCTIONS_BOOTSTRAP=true
["$_OFUNCTIONS_BOOTSTRAP" !=true]&&echo"Please use bootstrap.sh to load this dev version of $(basename $0)"&&exit1
@ -2518,7 +2529,7 @@ function RemoteLogger {
fi
return
elif["$level"=="ERROR"];then
_Logger """$prefix\e[91m$value\e[0m" true
_Logger """$prefix\e[31m$value\e[0m" true
if[$_DEBUG=="yes"];then
_Logger -e """[$retval] in [$(joinString , ${FUNCNAME[@]})] SP=$SCRIPT_PID P=$$" true
# Mac fswatch doesn't have timeout switch, replacing wait $! with WaitForTaskCompletion without warning nor spinner and increased SLEEP_TIME to avoid cpu hogging. This sims wait $! with timeout
#TODO: ExecTasks postponed arrays / files grow a lot. Consider having them "rolling"
#command line arguments don't take -AaqV for example
_OFUNCTIONS_VERSION=2.3.0-dev
_OFUNCTIONS_BUILD=2018062504
_OFUNCTIONS_VERSION=2.3.0-beta1
_OFUNCTIONS_BUILD=2018080801
_OFUNCTIONS_BOOTSTRAP=true
## BEGIN Generic bash functions written in 2013-2017 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr
## To use in a program, define the following variables:
## PROGRAM=program-name
## INSTANCE_ID=program-instance-name
@ -26,8 +20,6 @@ _OFUNCTIONS_BOOTSTRAP=true
## _LOGGER_ERR_ONLY=true/false
## _LOGGER_PREFIX="date"/"time"/""
#TODO: global WAIT_FOR_TASK_COMPLETION_id instead of callerName has to be backported to ParallelExec and osync / obackup / pmocr ocde
## Logger sets {ERROR|WARN}_ALERT variable when called with critical / error / warn loglevel
## When called from subprocesses, variable of main process cannot be set. Status needs to be get via $RUN_DIR/$PROGRAM.Logger.{error|warn}.$SCRIPT_PID.$TSTAMP
@ -210,7 +202,7 @@ function RemoteLogger {
fi
return
elif["$level"=="ERROR"];then
_Logger """$prefix\e[91m$value\e[0m" true
_Logger """$prefix\e[31m$value\e[0m" true
if[$_DEBUG=="yes"];then
_Logger -e """[$retval] in [$(joinString , ${FUNCNAME[@]})] SP=$SCRIPT_PID P=$$" true
fi
@ -337,7 +329,6 @@ function KillChilds {
fi
ifkill -0 "$pid" > /dev/null 2>&1;then
#TODO: Warning: pgrep is not native on cygwin, have this checked in CheckEnvironment
Logger "${FUNCNAME[0]} called by [$id] finished monitoring pid [$pid] with exitcode [$retval].""DEBUG"#TODO: set this to debug in order to stop complaints
Logger "${FUNCNAME[0]} called by [$id] finished monitoring pid [$pid] with exitcode [$retval].""DEBUG"
if["$functionMode"=="ParallelExec"];then
Logger "Command was [${commandsArrayPid[$pid]}].""ERROR"
fi
@ -1194,6 +1196,13 @@ function EscapeSpaces {
echo"${string// /\\}"
}
# Usage var=$(EscapeDoubleQuotes "$var") or var="$(EscapeDoubleQuotes "$var")"
function EscapeDoubleQuotes {
localvalue="${1}"
echo"${value//\"/\\\"}"
}
function IsNumericExpand {
eval"local value=\"${1}\""# Needed eval so variable variables can be processed
@ -1282,6 +1291,8 @@ function CheckRFC822 {
function UrlEncode {
locallength="${#1}"
local i
localLANG=C
for i in $(seq 0$((length-1)));do
localc="${1:i:1}"
@ -1502,6 +1513,9 @@ GetOs
ENDSSH
if[$? !=0];then
Logger "Cannot connect to remote system [$REMOTE_HOST] port [$REMOTE_PORT].""CRITICAL"