summaryrefslogtreecommitdiffstats
path: root/charts.d/postfix.chart.sh
diff options
context:
space:
mode:
Diffstat (limited to 'charts.d/postfix.chart.sh')
-rw-r--r--charts.d/postfix.chart.sh12
1 files changed, 7 insertions, 5 deletions
diff --git a/charts.d/postfix.chart.sh b/charts.d/postfix.chart.sh
index 524f1b2533..e0a7727d9e 100644
--- a/charts.d/postfix.chart.sh
+++ b/charts.d/postfix.chart.sh
@@ -1,4 +1,4 @@
-# shellcheck shell=bash
+# shellcheck shell=bash disable=SC1117
# no need for shebang - this file is loaded from charts.d.plugin
# SPDX-License-Identifier: GPL-3.0+
@@ -22,13 +22,15 @@ postfix_check() {
# - 1 to disable the chart
# try to find the postqueue executable
- if [ -z "$postfix_postqueue" -o ! -x "$postfix_postqueue" ]
+ if [ -z "$postfix_postqueue" ] || [ ! -x "$postfix_postqueue" ]
then
+ # shellcheck disable=SC2230
postfix_postqueue="$(which postqueue 2>/dev/null || command -v postqueue 2>/dev/null)"
fi
- if [ -z "$postfix_postqueue" -o ! -x "$postfix_postqueue" ]
+ if [ -z "$postfix_postqueue" ] || [ ! -x "$postfix_postqueue" ]
then
+ # shellcheck disable=SC2154
error "cannot find postqueue. Please set 'postfix_postqueue=/path/to/postqueue' in $confd/postfix.conf"
return 1
fi
@@ -68,10 +70,10 @@ postfix_update() {
postfix_q_emails=0
postfix_q_size=0
- eval "$(run $postfix_postqueue -p |\
+ eval "$(run "$postfix_postqueue" -p |\
grep "^--" |\
sed -e "s/-- \([0-9]\+\) Kbytes in \([0-9]\+\) Requests.$/local postfix_q_size=\1\nlocal postfix_q_emails=\2/g" |\
- egrep "^local postfix_q_(emails|size)=[0-9]+$")"
+ grep -E "^local postfix_q_(emails|size)=[0-9]+$")"
# write the result of the work.
cat <<VALUESEOF