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.
#!/bin/bash
OUTPUT=$(ps -ef | grep snmpd | wc -l)
if [ $OUTPUT -lt 1 ];
then
echo "SNMPD is not running"
else
echo "SNMPD is running"
fi