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,9 +190,13 @@ 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.
# - # -
if [[ "$LOCK_DIR" = "/tmp/${script_name%%.*}.LOCK" ]]; then # - Skip delay if running in an terminal (from copnsole)
_shift="$(( $RANDOM % 10 + 1 ))" # -
sleep $(( $RANDOM % 25 + $_shift )) if ! $terminal ; then
if [[ "$LOCK_DIR" = "/tmp/${script_name%%.*}.LOCK" ]]; then
_shift="$(( $RANDOM % 10 + 1 ))"
sleep $(( $RANDOM % 25 + $_shift ))
fi
fi fi
_stop_running=false _stop_running=false
@ -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
#----------------------------- #-----------------------------
#--------------------------------------- #---------------------------------------