Avatar of Frog_1337
Frog_1337

asked on 

HPUX Scripting

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
Shell ScriptingUnix OS

Avatar of undefined
Last Comment
woolmilkporc

8/22/2022 - Mon