0 Replies Latest reply on Aug 15, 2018 10:28 AM by jaromero

    validating unix/linux service status


      HI there...  Im validating a script that I found here in thwack to create monitors for unix/linux services running on redhat 6 servers


      script arguments::/bin/bash ${SCRIPT} jtv55



      status_output=`/sbin/service $1 status`


      if [[ $status_output = *stopped* ]]


              echo "Message: $1 service is NOT running"

              echo "Statistic: 1"

              exit 1

      elif [[ $status_output = *running* ]]


              echo "Message: $1 service is currently running"

              echo "Statistic: 0"

              exit 0




      While testing script: I manually stop the running services on the server ... but script output always tells me is "currently running" .. 

      Is there something wrong  with the script?  Any ideas on how make this script work correctly?