From 53860136a51217c27bb6c3a4b9442e9c84fa7e90 Mon Sep 17 00:00:00 2001 From: Lars Kruse Date: Tue, 13 Aug 2019 04:44:46 +0200 Subject: [PATCH] Plugin ejabberd_resources_: fix shellcheck issues --- plugins/ejabberd/ejabberd_resources_ | 62 ++++++++++++++++------------ 1 file changed, 36 insertions(+), 26 deletions(-) diff --git a/plugins/ejabberd/ejabberd_resources_ b/plugins/ejabberd/ejabberd_resources_ index d820b2de..37196951 100755 --- a/plugins/ejabberd/ejabberd_resources_ +++ b/plugins/ejabberd/ejabberd_resources_ @@ -27,8 +27,8 @@ #%# capabilities=autoconf suggest EJABBERDCTL_CFG=${ejabberdctl_cfg:-/etc/ejabberd/ejabberdctl.cfg} -source $EJABBERDCTL_CFG 2>/dev/null -source $MUNIN_LIBDIR/plugins/plugin.sh +. "$EJABBERDCTL_CFG" 2>/dev/null +. "$MUNIN_LIBDIR/plugins/plugin.sh" EJABBERDCTL=${ejabberdctl:-$(which ejabberdctl)} @@ -45,7 +45,7 @@ function ejabberd_exec() { echo "$1" | su - ejabberd -c "$ERL_CALL -e -n $ERLANG_NODE" | sed -re 's/^\{ok, (.*)\}$/\1/' } -SCRIPT_NAME=$(basename $0) +SCRIPT_NAME=$(basename "$0") RESOURCE_TYPE="${SCRIPT_NAME/ejabberd_resources_/}" RESOURCE_BASE=1000 [ "$RESOURCE_TYPE" = "memory" ] && RESOURCE_BASE=1024 @@ -57,8 +57,10 @@ function hosts_list() { function ejabberd_report_online_users() { [ "$1" = "config" ] && echo 'graph_vlabel users' for host in $(hosts_list); do - local clean_host=$(clean_fieldname $host) - local ejabberd_command="length(ejabberd_sm:get_vh_session_list(\"$host\"))" + local clean_host + local ejabberd_command + clean_host=$(clean_fieldname "$host") + ejabberd_command="length(ejabberd_sm:get_vh_session_list(\"$host\"))" if [ "$1" = "config" ]; then cat <