From 67f978378072f823726a0b24d448c4de937cf835 Mon Sep 17 00:00:00 2001 From: Lars Kruse Date: Wed, 4 Jul 2018 04:14:33 +0200 Subject: [PATCH] Plugins jstat__*: fix shellcheck issues; switch from bash to sh --- plugins/jvm/jstat__gccount | 10 +++++----- plugins/jvm/jstat__gctime | 10 +++++----- plugins/jvm/jstat__heap | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/plugins/jvm/jstat__gccount b/plugins/jvm/jstat__gccount index 64ef5475..934713ec 100755 --- a/plugins/jvm/jstat__gccount +++ b/plugins/jvm/jstat__gccount @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # Plugin for monitor JVM activity - GC Count - # @@ -64,7 +64,7 @@ get_jdk_type() { print_config() { - echo 'graph_title GC Count' $graphtitle + echo "graph_title GC Count $graphtitle" echo 'graph_args -l 0' echo 'graph_vlabel GC Count(times)' echo 'graph_total total' @@ -73,7 +73,7 @@ print_config() { echo 'Young_GC.label Young_GC' echo 'Young_GC.min 0' - if [ "${JDK_TYPE}" == "bea" ]; then + if [ "${JDK_TYPE}" = "bea" ]; then echo 'Old_GC.label Old_GC' echo 'Old_GC.min 0' else @@ -86,7 +86,7 @@ print_config() { print_stats() { local pid_num="$1" local awk_script - if [ "${JDK_TYPE}" == "bea" ]; then + if [ "${JDK_TYPE}" = "bea" ]; then # shellcheck disable=SC2016 awk_script='{ YC = $4; OC = $5; print "Young_GC.value " YGC; print "Old_GC.value " FGC; }' elif [ "${JDK_TYPE}" = "sun15" ]; then @@ -110,7 +110,7 @@ if [ "$1" = "autoconf" ]; then exit 1 fi - if [ ! -f "${pidfilepath}" -o ! -r "${pidfilepath}" ]; then + if [ ! -f "${pidfilepath}" ] || [ ! -r "${pidfilepath}" ]; then echo "no (No such file ${pidfilepath} or cannot read ${pidfilepath}" exit 1 fi diff --git a/plugins/jvm/jstat__gctime b/plugins/jvm/jstat__gctime index 662322b2..3cd69f17 100755 --- a/plugins/jvm/jstat__gctime +++ b/plugins/jvm/jstat__gctime @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # Plugin for monitor JVM activity - GC Time - # @@ -64,7 +64,7 @@ get_jdk_type() { print_config() { - echo 'graph_title GC Time' $graphtitle + echo "graph_title GC Time $graphtitle" echo 'graph_args -l 0' echo 'graph_vlabel GC Time(sec)' echo 'graph_total total' @@ -73,7 +73,7 @@ print_config() { echo 'Young_GC.label Young_GC' echo 'Young_GC.min 0' - if [ "${JDK_TYPE}" == "bea" ]; then + if [ "${JDK_TYPE}" = "bea" ]; then echo 'Old_GC.label Old_GC' echo 'Old_GC.min 0' echo 'Young_Pause.label Young_GC Pause' @@ -90,7 +90,7 @@ print_config() { print_stats() { local pid_num="$1" local awk_script - if [ "${JDK_TYPE}" == "bea" ]; then + if [ "${JDK_TYPE}" = "bea" ]; then # shellcheck disable=SC2016 awk_script='{ YCTime = $6; @@ -130,7 +130,7 @@ if [ "$1" = "autoconf" ]; then exit 1 fi - if [ ! -f "${pidfilepath}" -o ! -r "${pidfilepath}" ]; then + if [ ! -f "${pidfilepath}" ] || [ ! -r "${pidfilepath}" ]; then echo "no (No such file ${pidfilepath} or cannot read ${pidfilepath}" exit 1 fi diff --git a/plugins/jvm/jstat__heap b/plugins/jvm/jstat__heap index fbdfdfb1..5a2084e2 100755 --- a/plugins/jvm/jstat__heap +++ b/plugins/jvm/jstat__heap @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # Plugin for monitor JVM activity - Heap Usage - # @@ -64,13 +64,13 @@ get_jdk_type() { print_config() { - echo "graph_title Heap Usage" $graphtitle + echo "graph_title Heap Usage $graphtitle" echo "graph_args --base 1024 -l 0" echo "graph_vlabel Heap Usage(Bytes)" echo "graph_info Heap Usage" echo "graph_category virtualization" - if [ "${JDK_TYPE}" == "bea" ]; then + if [ "${JDK_TYPE}" = "bea" ]; then echo "NurserySize.label NurserySize" echo "HeapSize.label HeapSize" echo "UsedHeapSize.label UsedHeapSize" @@ -105,7 +105,7 @@ print_config() { print_stats() { local pid_num="$1" local awk_script - if [ "${JDK_TYPE}" == "bea" ]; then + if [ "${JDK_TYPE}" = "bea" ]; then # shellcheck disable=SC2016 awk_script='{ HeapSize = $1; @@ -185,7 +185,7 @@ if [ "$1" = "autoconf" ]; then exit 1 fi - if [ ! -f "${pidfilepath}" -o ! -r "${pidfilepath}" ]; then + if [ ! -f "${pidfilepath}" ] || [ ! -r "${pidfilepath}" ]; then echo "no (No such file ${pidfilepath} or cannot read ${pidfilepath}" exit 1 fi