check_local_webservice.sh: no delay if running in an terminal.
This commit is contained in:
parent
5899aef982
commit
15a4c23f15
@ -176,9 +176,19 @@ TIME_OUT_MAX="$(expr ${TIME_OUT} + 5)"
|
||||
|
||||
|
||||
# -------------
|
||||
# - Job is already running?
|
||||
# --- Check some prerequisites
|
||||
# -------------
|
||||
|
||||
# - Running in a terminal?
|
||||
# -
|
||||
if [[ -t 1 ]] ; then
|
||||
terminal=true
|
||||
LOGGING=true
|
||||
else
|
||||
terminal=false
|
||||
LOGGING=false
|
||||
fi
|
||||
|
||||
|
||||
# - Stop here, if these give scripts are running
|
||||
# -
|
||||
@ -191,9 +201,13 @@ if [[ ${#CONFLICTING_SCRIPTS} -gt 0 ]] ; then
|
||||
# - 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.
|
||||
# -
|
||||
if [[ "$LOCK_DIR" = "/tmp/${script_name%%.*}.LOCK" ]]; then
|
||||
_shift="$(( $RANDOM % 10 + 1 ))"
|
||||
sleep $(( $RANDOM % 25 + $_shift ))
|
||||
# - Skip delay if running in an terminal (from copnsole)
|
||||
# -
|
||||
if ! $terminal ; then
|
||||
if [[ "$LOCK_DIR" = "/tmp/${script_name%%.*}.LOCK" ]]; then
|
||||
_shift="$(( $RANDOM % 10 + 1 ))"
|
||||
sleep $(( $RANDOM % 25 + $_shift ))
|
||||
fi
|
||||
fi
|
||||
|
||||
_stop_running=false
|
||||
@ -237,6 +251,10 @@ if [[ ${#CONFLICTING_SCRIPTS} -gt 0 ]] ; then
|
||||
fi # if [[ ${#CONFLICTING_SCRIPTS} -gt 0 ]] ; then
|
||||
|
||||
|
||||
# -------------
|
||||
# - Job is already running?
|
||||
# -------------
|
||||
|
||||
# - If job already runs, stop execution..
|
||||
# -
|
||||
if mkdir "$LOCK_DIR" 2> /dev/null ; then
|
||||
@ -266,24 +284,10 @@ else
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# -------------
|
||||
# --- Check some prerequisites
|
||||
# --- Check some further prerequisites
|
||||
# -------------
|
||||
|
||||
# - Running in a terminal?
|
||||
# -
|
||||
if [[ -t 1 ]] ; then
|
||||
terminal=true
|
||||
LOGGING=true
|
||||
else
|
||||
terminal=false
|
||||
LOGGING=false
|
||||
fi
|
||||
|
||||
|
||||
# - Systemd supported ?
|
||||
# -
|
||||
systemd=$(which systemd)
|
||||
|
Loading…
Reference in New Issue
Block a user