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?