1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-22 22:25:23 +00:00

Plugin qstatcod4and5_: fix shellcheck issues

This commit is contained in:
Lars Kruse 2018-08-01 23:04:43 +02:00
parent eb9019d6ed
commit 57367ce98c

View file

@ -15,11 +15,9 @@
#---------------------------------------------------------------# #---------------------------------------------------------------#
# Set path to QSTAT # # Set path to QSTAT #
qstat_exe='/usr/local/bin/qstat' # qstat_exe='/usr/local/bin/qstat' #
# Set the Group for munin to be displayed e.x. games or COD4 #
munin_group='games' #
#---------------------------------------------------------------# #---------------------------------------------------------------#
# End of config # End of config
script_name=$(basename $0) script_name=$(basename "$0")
################################################################# #################################################################
################################################################# #################################################################
@ -37,9 +35,9 @@ usage() {
config() { config() {
if [ "${script_name}" != "qstatcod4and5_" ]; then if [ "${script_name}" != "qstatcod4and5_" ]; then
gametype=$(echo ${script_name} | cut -d_ -f2) gametype=$(echo "$script_name" | cut -d_ -f2)
ip=$(echo ${script_name} | cut -d_ -f3) ip=$(echo "$script_name" | cut -d_ -f3)
port=$(echo ${script_name} | cut -d_ -f4) port=$(echo "$script_name" | cut -d_ -f4)
else else
gametype=$1 gametype=$1
ip=$2 ip=$2
@ -48,7 +46,7 @@ config() {
echo "graph_title Number of players on ${gametype} - ${ip}:${port} echo "graph_title Number of players on ${gametype} - ${ip}:${port}
graph_vlabel players graph_vlabel players
graph_category ${munin_group} graph_category games
player.label players" player.label players"
} }
@ -57,24 +55,24 @@ player.label players"
#---------------------------------------------------------------# #---------------------------------------------------------------#
quake_stat() { quake_stat() {
if [ "${script_name}" != "qstatcod4and5_" ]; then if [ "${script_name}" != "qstatcod4and5_" ]; then
gametype=$(echo ${script_name} | cut -d_ -f2) gametype=$(echo "$script_name" | cut -d_ -f2)
ip=$(echo ${script_name} | cut -d_ -f3) ip=$(echo "$script_name" | cut -d_ -f3)
port=$(echo ${script_name} | cut -d_ -f4) port=$(echo "$script_name" | cut -d_ -f4)
else else
gametype=$1 gametype=$1
ip=$2 ip=$2
port=$3 port=$3
fi fi
if [ ! -z ${gametype} ] && [ ! -z ${gametype} ] && [ ! -z ${gametype} ]; then if [ ! -z "$gametype" ] && [ ! -z "$gametype" ] && [ ! -z "$gametype" ]; then
dummy=$(${qstat_exe} -P -pa -sort P -${gametype} ${ip}:${port} | grep frags | wc -l) dummy=$("$qstat_exe" -P -pa -sort P "-$gametype" "${ip}:${port}" | grep frags | wc -l)
playervalue=$dummy playervalue=$dummy
if [ -z "${playervalue}" ]; then if [ -z "$playervalue" ]; then
playervalue=0 playervalue=0
fi fi
echo "player.value "${playervalue}; echo "player.value $playervalue"
else else
echo "player.value U" echo "player.value U"
fi fi
@ -85,7 +83,7 @@ quake_stat() {
#---------------------------------------------------------------# #---------------------------------------------------------------#
case $1 in case $1 in
config) config)
config config "$1" "$2" "$3"
exit 0 exit 0
;; ;;
help | ?) help | ?)
@ -96,8 +94,7 @@ case $1 in
echo "no (edit the script for set qstat path)" echo "no (edit the script for set qstat path)"
;; ;;
*) *)
quake_stat $1 $2 $3 quake_stat "$1" "$2" "$3"
exit 0 exit 0
;; ;;
esac esac