diff --git a/check_local_webservice.sh b/check_local_webservice.sh index 7916343..41e7b11 100755 --- a/check_local_webservice.sh +++ b/check_local_webservice.sh @@ -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)