I am writing a script to check if the snmpd service is running on a dev server. I have the script written but every time I run it the results come back that the service is running even if I have manually stopped the service. I am very confused with this. The script is below.
OUTPUT=$(ps -ef | grep snmpd | wc -l)
if [ $OUTPUT -lt 1 ];
echo "SNMPD is not running"
echo "SNMPD is running"