LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Net-SNMP (snmpd) (https://www.linuxquestions.org/questions/linux-newbie-8/net-snmp-snmpd-448436/)

Mithrilhall 05-25-2006 10:10 AM

Net-SNMP (snmpd)
 
I just installed net-snmp and configured snmpd and it works great. The one problem I'm having is it doesn't start when the computer boots.

How can I get snmpd to start when the computer boots up?

BTW...I have no gui installed other than webmin. I'm doing all configuration changes from via CLI.

JimBass 05-25-2006 08:38 PM

Which of the distros listed in your sig is this on? How did you install net-snmp? If it was done from a source package, they sometimes include start up scripts, that can be installed with a command like make install-script or something like that. Browse the location where you unzipped the source, and you'll probably find some startup scripts. If you installed it through a package management system, it should have given you the choice to configure an autostart for the utility.

you usually find startup/stop scripts in /etc/init.d, or some closely related directory. In debian I would copy a script from /etc/init.d, and change the script itself to call net-snmp rather than whatever it did originally.

Peace,
JimBass

Mithrilhall 05-25-2006 09:15 PM

Thanks JimBass. I'm running Asterisk@Home 2.8 (aka CentOS 4.3) with no WM. I'll check the source package and see if there was a startup script included.

JimBass 05-25-2006 09:59 PM

Just to see I installed it from source, and not only does it not install startup scripts, it doesn't include sample ones. Digging through the net-snmp mail archives, I found somebody who posted a simple start stop script for Solaris, located here: http://sourceforge.net/mailarchive/m...msg_id=5099720

By changing the first line to #!/bin/bash from #!/sbin/sh everything works on my debian system. I ran through the debian system to cause that script (/etc/init.d/net-snmp on mine) to be started automatically at boot. The code itself in that file looks like this:

Code:

#!/bin/bash
#
case "$1" in
"start")
      /usr/local/sbin/snmpd
      ;;

"stop")
      /usr/bin/pkill -9 -x -u 0 "(snmpd|snmptrapd)"
      ;;

*)
      echo "Usage: $0 { start | stop }"
      exit 1
      ;;
esac
exit 0

I don't know CentOS, so figuring out where to put that script and how to make it auto start falls back to you, but this code should make the service run.

peace,
JimBass


All times are GMT -5. The time now is 04:06 AM.