2008/4/28 Jelena Savic :
> >> Is there a way that i can notify my process when snmpd is
> >> ready without arbitrarily sleeping for some time before
> >> starting up the second process?

> >$ snmpgetnext [valid creds] -t 10 -r 60 .1.3
> >
> > ...will wait up to ten minutes for a valid response, retrying every ten seconds.
> > Check the return code - 0 means the agent is up, anything else means abort.

> How do i check the return code of snmpgetnext?


snmpgetnext .... > /dev/null 2>&1 && echo Server is up


if snmpgetnext .... > /dev/null 2>&1
echo Server is up

(They both work in effectively the same manner, but the second format
makes it simpler to run multiple commands).

The "> /dev/null 2>&1" is simply to throw away any output,
assuming that you're *just* interested in the success/failure of the request.


This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
Net-snmp-users mailing list
Please see the following page to unsubscribe or change other options: