]> johannes.truschnigg.info Git - sqm_lagthrottle/commitdiff
Redirect error messages to stderr
authorJohannes Truschnigg <johannes@truschnigg.info>
Sun, 20 Mar 2022 15:08:10 +0000 (16:08 +0100)
committerJohannes Truschnigg <johannes@truschnigg.info>
Sun, 20 Mar 2022 15:08:10 +0000 (16:08 +0100)
sqm_lagthrottle.sh

index 8f976d353bc3149e10e354bbe291b8c21ec40088..ff0c8b1a9c18425004edabc71ca34b3bb30171fc 100755 (executable)
@@ -107,13 +107,13 @@ done
 
 if [ -r "${SQML_CFGFILE}" ] && sh -n "${SQML_CFGFILE}"
 then
-  printf 'Evaluating configuration delta from file "%s"...\n' "${SQML_CFGFILE}"
+  printf 'Evaluating configuration delta from file "%s"...\n' "${SQML_CFGFILE}" >&2
   eval "set -x; $(grep -E '[A-Z][A-Z_]+=' "${SQML_CFGFILE}"); set +x"
   _cfg_ok=$?
   set +x
   if [ ${_cfg_ok} -ne 0 ]
   then
-    printf 'FATAL: Configuration delta in "%s" could not be evaluated without errors."\n'
+    printf 'FATAL: Configuration delta in "%s" could not be evaluated without errors."\n' >&2
     exit 1
   fi
 fi
@@ -121,7 +121,7 @@ fi
 
 if ! test -r ./__sqm_lagthrottle.awk
 then
-  printf 'FATAL: "__sqm_lagthrottle.awk" not found; are you in the correct directory?"\n'
+  printf 'FATAL: "__sqm_lagthrottle.awk" not found; are you in the correct directory?"\n' >&2
   exit 1
 fi
 
@@ -140,42 +140,42 @@ fi
 
 if ! __is_num "${THRESHOLD}"
 then
-  printf 'FATAL: Invalid value for THRESHOLD\n'
+  printf 'FATAL: Invalid value for THRESHOLD\n' >&2
   exit 1
 fi
 
 
 if ! __is_num "${FUDGE_MS}"
 then
-  printf 'FATAL: Invalid value for FUDGE_MS\n'
+  printf 'FATAL: Invalid value for FUDGE_MS\n' >&2
   exit 1
 fi
 
 
 if ! __is_int "${PING_SLOTS_PER_PEER}"
 then
-  printf 'FATAL: Invalid value for PING_SLOTS_PER_PEER\n'
+  printf 'FATAL: Invalid value for PING_SLOTS_PER_PEER\n' >&2
   exit 1
 fi
 
 
 if ! __is_int "${PING_INTERVAL}"
 then
-  printf 'FATAL: Invalid value for PING_INTERVAL\n'
+  printf 'FATAL: Invalid value for PING_INTERVAL\n' >&2
   exit 1
 fi
 
 
 if ! __is_int "${BW_MIN_RX}"
 then
-  printf 'FATAL: Invalid value for PING_SLOTS_PER_PEER\n'
+  printf 'FATAL: Invalid value for PING_SLOTS_PER_PEER\n' >&2
   exit 1
 fi
 
 
 if ! __is_int "${BW_MAX_RX}"
 then
-  printf 'FATAL: Invalid value for PING_SLOTS_PER_PEER\n'
+  printf 'FATAL: Invalid value for PING_SLOTS_PER_PEER\n' >&2
   exit 1
 fi
 
@@ -185,7 +185,7 @@ do
   read -r _bw < "${f}"
   if ! __is_int "${_bw}"
   then
-    printf 'FATAL: Interface stats file "%s" seems bogus\n' "${f}"
+    printf 'FATAL: Interface stats file "%s" seems bogus\n' "${f}" >&2
     exit 1
   fi
 done
@@ -195,7 +195,7 @@ for i in "${IFACE_RX}" "${IFACE_TX}"
 do
   if ! ip link show "${i}" >/dev/null
   then
-    printf 'FATAL: Interface "%s" seems bogus\n' "${i}"
+    printf 'FATAL: Interface "%s" seems bogus\n' "${i}" >&2
     exit 1
   fi
 done
@@ -207,7 +207,7 @@ do
   _qd="$(tc qdisc show dev "${i}" | awk '/^qdisc/{print $2}')"
   if ! [ x"${_qd}" = xcake ]
   then
-    printf 'FATAL: Interface "%s" does not seem to have cake SQM set up\n' "${i}"
+    printf 'FATAL: Interface "%s" does not seem to have cake SQM set up\n' "${i}" >&2
     exit 1
   fi
 done
@@ -219,7 +219,7 @@ case "${OPTIMIZATION_PREFERENCE}" in
   bandwidth)
   ;;
   *)
-    printf 'FATAL: Invalid setting for OPTIMIZATION_PREFERENCE - choose either "bandwidth" or "latency".\n'
+    printf 'FATAL: Invalid setting for OPTIMIZATION_PREFERENCE - choose either "bandwidth" or "latency".\n' >&2
     exit 1
   ;;
 esac
@@ -231,7 +231,7 @@ case "${TREND_DECISION}" in
   relaxed)
   ;;
   *)
-    printf 'FATAL: Invalid setting for TREND_DECISION - choose either "eager" or "relaxed".\n'
+    printf 'FATAL: Invalid setting for TREND_DECISION - choose either "eager" or "relaxed".\n' >&2
     exit 1
   ;;
 esac