]> Sergey Matveev's repositories - sgmon.git/commitdiff
Ability to set default number of attempts
authorSergey Matveev <stargrave@stargrave.org>
Fri, 1 Apr 2022 07:49:35 +0000 (10:49 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Tue, 3 May 2022 11:38:37 +0000 (14:38 +0300)
README
run.sh

diff --git a/README b/README
index 965731349efcfe61892c6d40508dec01bc87252d..d59c6a90a6f3ae0829b0df18dbe290dc89125e86 100644 (file)
--- a/README
+++ b/README
@@ -30,6 +30,7 @@ Set default configuration values:
     $ cat > rc <<EOF
     NOTIFY_EMAIL=user+sgmon@example.com
     PERIOD_DEFAULT=60
+    ATTEMPTS_DEFAULT=1
     EOF
 
 You can run probe individually for testing:
diff --git a/run.sh b/run.sh
index 3bc7a880afae6d37409f4c72ed488228dc100d20..27d72020f79e793186d788930fa2eaefcd87fd77 100755 (executable)
--- a/run.sh
+++ b/run.sh
@@ -10,7 +10,7 @@ ln -s $SGMONTMP state
 trap "rm -fr state $SGMONTMP" HUP PIPE INT QUIT TERM EXIT
 
 while : ; do
-    [ -s max-attempts ] && read max_attempts < max-attempts || max_attempts=1
+    [ -s max-attempts ] && read max_attempts < max-attempts || max_attempts=$ATTEMPTS_DEFAULT
     [ -s state/attempts ] && read attempts < state/attempts || attempts=0
     [ -x run ] && cmd=./run || cmd="sh -e run"
     if $cmd >state/stdout 2>state/stderr ; then