From f26c34419bb7457f85b7047b6a9994e15f3c5dfd Mon Sep 17 00:00:00 2001 From: Johannes Truschnigg Date: Sun, 20 Mar 2022 16:08:10 +0100 Subject: [PATCH] Redirect error messages to stderr --- sqm_lagthrottle.sh | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/sqm_lagthrottle.sh b/sqm_lagthrottle.sh index 8f976d3..ff0c8b1 100755 --- a/sqm_lagthrottle.sh +++ b/sqm_lagthrottle.sh @@ -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 -- 2.39.5