check_webservice_load.sh: no delay if running in an terminal.

This commit is contained in:
Christoph 2022-02-02 18:39:09 +01:00
parent 9b857d5756
commit 5899aef982

View File

@ -138,6 +138,25 @@ trim() {
} }
#---------------------------------------
#-----------------------------
# Check some prerequisites
#-----------------------------
#---------------------------------------
if [[ -t 1 ]] ; then
terminal=true
LOGGING=true
else
terminal=false
LOGGING=false
fi
# - Detect linux distribution
# -
detect_os
# ------------- # -------------
# --- Read Configurations from $conf_file # --- Read Configurations from $conf_file
# ------------- # -------------
@ -171,10 +190,14 @@ if [[ ${#CONFLICTING_SCRIPTS} -gt 0 ]] ; then
# - This only makes sense if a fixed LOCK directory is used, otherwise the process list # - This only makes sense if a fixed LOCK directory is used, otherwise the process list
# - (and NOT the LOCK-directory) is used to look for scripts running in parallel. # - (and NOT the LOCK-directory) is used to look for scripts running in parallel.
# - # -
# - Skip delay if running in an terminal (from copnsole)
# -
if ! $terminal ; then
if [[ "$LOCK_DIR" = "/tmp/${script_name%%.*}.LOCK" ]]; then if [[ "$LOCK_DIR" = "/tmp/${script_name%%.*}.LOCK" ]]; then
_shift="$(( $RANDOM % 10 + 1 ))" _shift="$(( $RANDOM % 10 + 1 ))"
sleep $(( $RANDOM % 25 + $_shift )) sleep $(( $RANDOM % 25 + $_shift ))
fi fi
fi
_stop_running=false _stop_running=false
for _val in $CONFLICTING_SCRIPTS ; do for _val in $CONFLICTING_SCRIPTS ; do
@ -256,29 +279,10 @@ fi
#trap 'rm -rf "$LOCK_DIR"' 0 2 15 #trap 'rm -rf "$LOCK_DIR"' 0 2 15
#---------------------------------------
#-----------------------------
# Check some prerequisites
#-----------------------------
#---------------------------------------
if [[ -t 1 ]] ; then
terminal=true
LOGGING=true
else
terminal=false
LOGGING=false
fi
# - Detect linux distribution
# -
detect_os
#--------------------------------------- #---------------------------------------
#----------------------------- #-----------------------------
# Check some prerequisites # Check some further prerequisites
#----------------------------- #-----------------------------
#--------------------------------------- #---------------------------------------