Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19
Auto start snmpd
Results 1 to 6 of 6

Thread: Auto start snmpd

  1. #1

    Auto start snmpd

    Hi, I have been trying to bring up snmpd automatically without luck. I would appreciate if anyone could point out what I did wrong. What I did:

    (1). Put the following script (named snmp) in /etc/init.d:
    #!/bin/sh

    test -x /usr/local/sbin/snmpd || exit 0

    SNMPDPID=/var/run/snmpd.pid

    case "$1" in
    * * *start)
    * * * * * *echo -n "Starting SNMP server: snmp"
    * * * * * *sleep 30
    * * * * * *start-stop-daemon --start --quiet --pidfile $SNMPDPID \
    * * * * * * * * *--exec /usr/local/sbin/snmpd
    * * * * * *echo "."
    * * * * * *;;
    * * *stop)
    * * * * * *echo -n "Stopping SNMP server: snmp"
    * * * * * *start-stop-daemon --stop --quiet --pidfile $SNMPDPID
    * * * * * *echo "."
    * * * * * *;;
    * * *restart | force-reload)
    * * * * * *echo -n "Stopping SNMP server: snmp"
    * * * * * *start-stop-daemon --stop --quiet --pidfile $SNMPDPID
    * * * * * *echo "."
    * * * * * *sleep 2
    * * * * * *echo -n "Starting SNMP server: snmp"
    * * * * * *start-stop-daemon --start --quiet --pidfile $SNMPDPID \
    * * * * * * * * *--exec /usr/local/sbin/snmpd
    * * * * * *echo "."
    * * * * * *;;
    * * **)
    * * * * * *echo "Usage: /etc/init.d/snmp {start|stop|restart|force-reload}"
    * * * * * *exit 1
    esac

    exit 0


    (2). Make a symlink: /etc/rc3.d/S99snmp -> ../init.d/snmp

    (3). After log on as root, do "init 3"

    My snmpd makes call to another program, and I do see printf message from that program. However, I don't see printf message from snmpd itself. "ps -ef | grep snmpd" doesn't show snmpd running.

    If I run "/etc/init.d/snmp start" at command line, snmpd does get started and function normally.

    By the way, "sleep 30" in snmp script is to make sure the other program comes up and running before starting snmpd. I made sure 30 seconds is enough for that. The other program is also auto-start (successfully, with /etc/rc3.d/S98...).

    Thanks for your attention.

  2. #2

    Re: Auto start snmpd

    You can start it via rc.local if you like (more BSD style). Just add /path/to/snmpd && echo "SNMP Started! ".

  3. #3

    Re: Auto start snmpd

    Hi, Ashcrow:
    Thanks for your reply. I am new to Linux so I have the following questions:
    1. Should rc.local be in /etc?
    2. How to run what's in rc.local?
    3. My snmpd has to wait until another process comes up correctly. This process is started at running level 3 (by "init 3&quot. Is it possible to tell rc.local not to start until all processes in rc3.d are started?

    I appreciate your time.


    You can start it via rc.local if you like (more BSD style). Just add /path/to/snmpd && echo "SNMP Started! ".

  4. #4
    Moderator
    Good Guru
    Compunuts's Avatar
    Join Date
    May 2001
    Location
    California
    Posts
    3,935

    Re: Auto start snmpd


    1. Should rc.local be in /etc?
    Well, you didn't say what distro you use.

    In my Red Hat, the rc.local file is in /etc. In my Debian (Woody), they use rcS.d with individual scripts in there.

    2. How to run what's in rc.local?
    So if it's rc.local, then you type in what Ashcrow said to that file and it should start up at boot time.

    3. My snmpd has to wait until another process comes up correctly. This process is started at running level 3 (by "init 3&quot.
    Then you should run your script in rc3.d after the other process is done initiating.

    Is it possible to tell rc.local not to start until all processes in rc3.d are started?
    Nope. rc.local start before it enter into the run levels. rc.local is what started up when your system boot up. Many distros avoid to use rc.local lately unless absolutely need to. Starting from run levels is easier to manage since all you need is delete or rename files for that service and you are done instead of looking for that script area and modifying/commenting.

  5. #5
    Moderator
    Good Guru
    Schotty's Avatar
    Join Date
    Jul 2001
    Location
    Milwaukee, WI
    Posts
    5,760

    Re: Auto start snmpd

    Well, in RedHat, MAndrake, and SuSE the service/daemon scripts are all in the rcX.d directory. Each script is going to be a SYYservicename or KYYservicename. The S and K is for start and kill, and the YY is the number following it denoting the order in which to startup/kill that service.Make a S and K script and plop it in each runlevel you want. That is denoted by the rcX.d directory, in which X is the runlevel.

    HTH

  6. #6

    Re: Auto start snmpd

    Thanks for all your replies. I use Debian. I setup correctly for snmp to start in rc3.d. My problem is, when I run "init 3", snmpd tries to start but doesn't stay up. However, if I run snmp startup script manully at command line prompt, snmpd starts and stays up. Could anyone tell me what's the difference between these two ways to bring up the daemon?

Similar Threads

  1. Auto logging into root
    By comtux in forum Linux - General Topics
    Replies: 6
    Last Post: 11-30-2004, 02:53 PM
  2. mgetty auto login
    By edalfon in forum Linux - Hardware, Networking & Security
    Replies: 1
    Last Post: 09-26-2004, 02:37 AM
  3. Using cron for auto tasks
    By sharon63 in forum Linux - General Topics
    Replies: 5
    Last Post: 02-27-2004, 02:02 PM
  4. Stoping X from auto starting?
    By bobblebob in forum Linux - Software, Applications & Programming
    Replies: 2
    Last Post: 05-09-2003, 05:14 PM
  5. Auto dial in for RH 7.3?
    By datamike in forum Linux - General Topics
    Replies: 7
    Last Post: 07-18-2002, 11:13 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •