From eb4855b77b542ce4531446e5c086f4db171a2ba6 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Fri, 3 Aug 2018 00:14:44 +0000 Subject: [PATCH] check_email_deliverer_process: Fix shellcheck warnings. In puppet/zulip/files/nagios_plugins/zulip_app_frontend/check_email_deliverer_process line 16: elif [ "$(echo "$STATUS" | egrep '(STOPPED)|(STARTING)|(BACKOFF)|(STOPPING)|(EXITED)|(FATAL)|(UNKNOWN)$')" ] ^-- SC2143: Use egrep -q instead of comparing output with [ -n .. ]. ^-- SC2196: egrep is non-standard and deprecated. Use grep -E instead. Signed-off-by: Anders Kaseorg --- .../check_email_deliverer_process | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/puppet/zulip/files/nagios_plugins/zulip_app_frontend/check_email_deliverer_process b/puppet/zulip/files/nagios_plugins/zulip_app_frontend/check_email_deliverer_process index 518a3fb003..180183e5b3 100755 --- a/puppet/zulip/files/nagios_plugins/zulip_app_frontend/check_email_deliverer_process +++ b/puppet/zulip/files/nagios_plugins/zulip_app_frontend/check_email_deliverer_process @@ -9,18 +9,20 @@ SUPERVISOR_STATUS=$(supervisorctl status zulip-workers:zulip-deliver-enqueued-em STATUS=$(echo "$SUPERVISOR_STATUS" | awk '{ print $2 }') -if [ "$STATUS" == "RUNNING" ] -then - echo "Running" - exit 0 -elif [ "$(echo "$STATUS" | egrep '(STOPPED)|(STARTING)|(BACKOFF)|(STOPPING)|(EXITED)|(FATAL)|(UNKNOWN)$')" ] -then - # not "RUNNING", but a recognized supervisor status - echo "$STATUS" - exit 1 -else - # we don't recognize the second column in this SUPERVISOR_STATUS. - # This may be indicative of a supervisor configuration problem - echo "$SUPERVISOR_STATUS" - exit 3 -fi +case "$STATUS" in + RUNNING) + echo "Running" + exit 0 + ;; + STOPPED|STARTING|BACKOFF|STOPPING|EXITED|FATAL|UNKNOWN) + # not "RUNNING", but a recognized supervisor status + echo "$STATUS" + exit 1 + ;; + *) + # we don't recognize the second column in this SUPERVISOR_STATUS. + # This may be indicative of a supervisor configuration problem + echo "$SUPERVISOR_STATUS" + exit 3 + ;; +esac