Quantcast
Channel: THWACK: All Content - Server & Application Monitor
Viewing all articles
Browse latest Browse all 12281

validating unix/linux service status

$
0
0

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

 

#!/bin/bash

status_output=`/sbin/service $1 status`

 

if [[ $status_output = *stopped* ]]

then

        echo "Message: $1 service is NOT running"

        echo "Statistic: 1"

        exit 1

elif [[ $status_output = *running* ]]

then

        echo "Message: $1 service is currently running"

        echo "Statistic: 0"

        exit 0

 

fi

 

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?


Viewing all articles
Browse latest Browse all 12281

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>