Просмотр исходного кода

bugfix: script will throw errors if -t parameter is used - need to initialize
default value for the TRUST_EXIT_STATUS at the top of the script. Also added
comments about the setting.

Tobias Brox 8 лет назад
Родитель
Сommit
a06e1b287a
1 измененных файлов с 5 добавлено и 1 удалено
  1. 5 1
      check_service.sh

+ 5 - 1
check_service.sh

@@ -23,6 +23,11 @@ WARNING=1
 CRITICAL=2
 CRITICAL=2
 UNKNOWN=3
 UNKNOWN=3
 
 
+# Weather or not we can trust the exit code from the service management tool.
+# Defaults to 0, put to 1 for systemd.  Otherwise we must rely on parsing the
+# output from the service management tool.
+TRUST_EXIT_CODE=0
+
 usage()
 usage()
 {
 {
 cat <<EOF
 cat <<EOF
@@ -68,7 +73,6 @@ fi
 
 
 
 
 determine_service_tool() {
 determine_service_tool() {
-TRUST_EXIT_CODE=0
 if [[ $OS == linux ]]; then
 if [[ $OS == linux ]]; then
         if command -v systemctl >/dev/null 2>&1; then
         if command -v systemctl >/dev/null 2>&1; then
                 SERVICETOOL="systemctl status $SERVICE"
                 SERVICETOOL="systemctl status $SERVICE"