mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
quake plugins: fix shellcheck issues
This commit is contained in:
parent
ba66ff7490
commit
8fa7e61b43
@ -13,7 +13,7 @@ qstat_exe='/usr/local/bin/qstat'
|
|||||||
|
|
||||||
#---------------------------------------------------------------#
|
#---------------------------------------------------------------#
|
||||||
# End of config
|
# End of config
|
||||||
script_name=$(basename $0)
|
script_name=$(basename "$0")
|
||||||
#################################################################
|
#################################################################
|
||||||
|
|
||||||
#################################################################
|
#################################################################
|
||||||
@ -29,9 +29,9 @@ usage() {
|
|||||||
|
|
||||||
config() {
|
config() {
|
||||||
if [ "${script_name}" != "qstat_" ]; then
|
if [ "${script_name}" != "qstat_" ]; 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
|
||||||
@ -51,20 +51,20 @@ player.label players"
|
|||||||
#---------------------------------------------------------------#
|
#---------------------------------------------------------------#
|
||||||
quake_stat() {
|
quake_stat() {
|
||||||
if [ "${script_name}" != "qstat_" ]; then
|
if [ "${script_name}" != "qstat_" ]; 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} -raw ";" -nh -${gametype} ${ip}:${port})
|
dummy=$("$qstat_exe" -raw ";" -nh "-$gametype" "${ip}:${port}")
|
||||||
|
|
||||||
playervalue=$(echo ${dummy} | cut -d\; -f6)
|
playervalue=$(echo "$dummy" | cut -d\; -f6)
|
||||||
maxplayervalue=$(echo ${dummy} | cut -d\; -f5)
|
maxplayervalue=$(echo "$dummy" | cut -d\; -f5)
|
||||||
|
|
||||||
if [ -z "${playervalue}" ]; then
|
if [ -z "${playervalue}" ]; then
|
||||||
playervalue=0
|
playervalue=0
|
||||||
@ -88,7 +88,7 @@ quake_stat() {
|
|||||||
#---------------------------------------------------------------#
|
#---------------------------------------------------------------#
|
||||||
case $1 in
|
case $1 in
|
||||||
config)
|
config)
|
||||||
config
|
config "$@"
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
help | ?)
|
help | ?)
|
||||||
@ -99,7 +99,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 "$@"
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -13,7 +13,7 @@ qstat_exe='/usr/bin/qstat'
|
|||||||
|
|
||||||
#---------------------------------------------------------------#
|
#---------------------------------------------------------------#
|
||||||
# End of config
|
# End of config
|
||||||
script_name=$(basename $0)
|
script_name=$(basename "$0")
|
||||||
#################################################################
|
#################################################################
|
||||||
|
|
||||||
#################################################################
|
#################################################################
|
||||||
@ -29,9 +29,9 @@ usage() {
|
|||||||
|
|
||||||
config() {
|
config() {
|
||||||
if [ "${script_name}" != "qstat_" ]; then
|
if [ "${script_name}" != "qstat_" ]; 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
|
||||||
@ -51,20 +51,19 @@ player.label players"
|
|||||||
#---------------------------------------------------------------#
|
#---------------------------------------------------------------#
|
||||||
quake_stat() {
|
quake_stat() {
|
||||||
if [ "${script_name}" != "qstat_" ]; then
|
if [ "${script_name}" != "qstat_" ]; 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 | grep -wv 0ms | wc -l)
|
stat_output=$("$qstat_exe" -P -pa -sort P "-$gametype" "${ip}:${port}" | grep frags)
|
||||||
dummy2=$(${qstat_exe} -P -pa -sort P -${gametype} ${ip}:${port} | grep frags | grep -w 0ms | wc -l)
|
playervalue=$(echo "$stat_output" | grep -cwv 0ms)
|
||||||
playervalue=$dummy
|
maxplayervalue=$(echo "$stat_output" | grep -cw 0ms)
|
||||||
maxplayervalue=$dummy2
|
|
||||||
|
|
||||||
if [ -z "${playervalue}" ]; then
|
if [ -z "${playervalue}" ]; then
|
||||||
playervalue=0
|
playervalue=0
|
||||||
@ -88,7 +87,7 @@ quake_stat() {
|
|||||||
#---------------------------------------------------------------#
|
#---------------------------------------------------------------#
|
||||||
case $1 in
|
case $1 in
|
||||||
config)
|
config)
|
||||||
config
|
config "$@"
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
help | ?)
|
help | ?)
|
||||||
@ -99,7 +98,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 "$@"
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -13,7 +13,7 @@ qstat_exe='/usr/bin/qstat'
|
|||||||
|
|
||||||
#---------------------------------------------------------------#
|
#---------------------------------------------------------------#
|
||||||
# End of config
|
# End of config
|
||||||
script_name=$(basename $0)
|
script_name=$(basename "$0")
|
||||||
#################################################################
|
#################################################################
|
||||||
|
|
||||||
#################################################################
|
#################################################################
|
||||||
@ -29,9 +29,9 @@ usage() {
|
|||||||
|
|
||||||
config() {
|
config() {
|
||||||
if [ "${script_name}" != "qstat_" ]; then
|
if [ "${script_name}" != "qstat_" ]; 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
|
||||||
@ -51,20 +51,19 @@ player.label players"
|
|||||||
#---------------------------------------------------------------#
|
#---------------------------------------------------------------#
|
||||||
quake_stat() {
|
quake_stat() {
|
||||||
if [ "${script_name}" != "qstat_" ]; then
|
if [ "${script_name}" != "qstat_" ]; 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 team | grep -wv 0ms | wc -l)
|
stat_output=$("$qstat_exe" -P -pa -sort P "-${gametype}" "${ip}:${port}" | grep team)
|
||||||
dummy2=$(${qstat_exe} -P -pa -sort P -${gametype} ${ip}:${port} | grep team | grep -w 0ms | wc -l)
|
playervalue=$(echo "$stat_output" | grep -cwv 0ms)
|
||||||
playervalue=$dummy
|
maxplayervalue=$(echo "$stat_output" | grep -cw 0ms)
|
||||||
maxplayervalue=$dummy2
|
|
||||||
|
|
||||||
if [ -z "${playervalue}" ]; then
|
if [ -z "${playervalue}" ]; then
|
||||||
playervalue=0
|
playervalue=0
|
||||||
@ -74,7 +73,6 @@ quake_stat() {
|
|||||||
maxplayervalue=0
|
maxplayervalue=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
echo "maxplayer.value "${maxplayervalue};
|
echo "maxplayer.value "${maxplayervalue};
|
||||||
echo "player.value "${playervalue};
|
echo "player.value "${playervalue};
|
||||||
else
|
else
|
||||||
@ -88,7 +86,7 @@ quake_stat() {
|
|||||||
#---------------------------------------------------------------#
|
#---------------------------------------------------------------#
|
||||||
case $1 in
|
case $1 in
|
||||||
config)
|
config)
|
||||||
config
|
config "$@"
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
help | ?)
|
help | ?)
|
||||||
@ -99,8 +97,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 "$@"
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user