~ubuntu-branches/ubuntu/precise/net-snmp/precise

« back to all changes in this revision

Viewing changes to debian/snmpd.init

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2009-11-26 01:27:00 UTC
  • mfrom: (1.1.9 sid)
  • Revision ID: james.westby@ubuntu.com-20091126012700-pox7w0a5j2x305h9
Tags: 5.4.2.1~dfsg-3ubuntu1
* Merge from debian testing.  Remaining changes:
  - Set Ubuntu maintainer address.
  - net-snmp-config: Use bash. (LP: #104738)
  - Removed multiuser option when calling update-rc.d. (LP: #254261)
  - debian/snmpd.init: LSBify the init script.
  - debian/patches/52_fix_snmpcmd_1_typo.patch: Adjust a typo in snmpcmd.1
    (LP: #250459)
  - debian/patches/99-fix-ubuntu-div0.patch: Fix dvision by zero.
    (LP: #426813).
 * Dropped patches:
   - debian/patches/101-fix-ipalias.patch: Applied upstream.
   - debian/patches/99-fix-net-snmp-syslog.patch: Applied upstream.
   - debian/patches/99-fix-perl-counter-in-subagent.patch: Applied upstream.
   - ebian/patches/103-fix-ubuntu-lmsensors.patch: No longer needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#! /bin/sh -e
2
2
### BEGIN INIT INFO
3
3
# Provides:           snmpd snmptrapd
4
 
# Required-Start:     $network $local_fs
5
 
# Required-Stop:      $network $local_fs
 
4
# Required-Start:     $network $remote_fs $syslog
 
5
# Required-Stop:      $network $remote_fs $syslog
6
6
# Default-Start:      2 3 4 5
7
7
# Default-Stop:       0 1 6
8
8
# Short-Description:  SNMP agents
13
13
#
14
14
set -e
15
15
 
 
16
. /lib/lsb/init-functions
 
17
 
16
18
export PATH=/sbin:/usr/sbin:/bin:/usr/bin
17
19
 
18
 
. /lib/lsb/init-functions
19
 
 
20
20
test -x /usr/sbin/snmpd || exit 0
21
21
test -x /usr/sbin/snmptrapd || exit 0
22
22
 
23
23
# Defaults
24
 
export MIBDIRS=/usr/share/snmp/mibs
 
24
export MIBDIRS=/usr/share/mibs/iana:/usr/share/mibs/ietf:/usr/share/mibs/netsnmp
25
25
SNMPDRUN=yes
26
26
SNMPDOPTS='-Lsd -Lf /dev/null -p /var/run/snmpd.pid'
27
27
TRAPDRUN=no
34
34
cd /
35
35
 
36
36
# Create compatibility link to old AgentX socket location
37
 
if [ "$SNMPDCOMPAT" = "yes" ]; then
 
37
if [ "$SNMPDCOMPAT" = "yes" ] && [ "$1" != status ]; then
38
38
  ln -sf /var/agentx/master /var/run/agentx
39
39
fi
40
40
 
44
44
    if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then
45
45
        start-stop-daemon --quiet --start --oknodo --exec /usr/sbin/snmpd \
46
46
            -- $SNMPDOPTS
47
 
        log_progress_msg "snmpd"
 
47
        log_progress_msg " snmpd"
48
48
    fi
49
49
    if [ "$TRAPDRUN" = "yes" -a -f /etc/snmp/snmptrapd.conf ]; then
50
50
        start-stop-daemon --quiet --start --oknodo --exec /usr/sbin/snmptrapd \
51
51
            -- $TRAPDOPTS
52
 
        log_progress_msg "snmptrapd"
 
52
        log_progress_msg " snmptrapd"
53
53
    fi
54
 
    log_end_msg 0
55
54
    ;;
56
55
  stop)
57
56
    log_daemon_msg "Stopping network management services:"
58
57
    start-stop-daemon --quiet --stop --oknodo --exec /usr/sbin/snmpd
59
 
    log_progress_msg "snmpd"
 
58
    log_progress_msg " snmpd"
60
59
    start-stop-daemon --quiet --stop --oknodo --exec /usr/sbin/snmptrapd
61
 
    log_progress_msg "snmptrapd"
62
 
    log_end_msg 0
 
60
    log_progress_msg " snmptrapd"
63
61
    ;;
64
62
  restart)
65
63
    log_daemon_msg "Restarting network management services:"
69
67
    sleep 2
70
68
    if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then
71
69
        start-stop-daemon --quiet --start --exec /usr/sbin/snmpd -- $SNMPDOPTS
72
 
        log_progress_msg "snmpd"
 
70
        log_progress_msg " snmpd"
73
71
    fi
74
72
    if [ "$TRAPDRUN" = "yes" -a -f /etc/snmp/snmptrapd.conf ]; then
75
73
        # Allow snmpd time to start up.
76
74
        sleep 1
77
75
        start-stop-daemon --quiet --start --exec /usr/sbin/snmptrapd -- $TRAPDOPTS
78
 
        log_progress_msg "snmptrapd"
 
76
        log_progress_msg " snmptrapd"
79
77
    fi
80
 
    log_end_msg 0
81
78
    ;;
82
79
  reload|force-reload)
83
80
    log_daemon_msg "Reloading network management services:"
84
81
    if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then
85
82
        start-stop-daemon --quiet --stop --signal 1 \
86
83
            --pidfile /var/run/snmpd.pid --exec /usr/sbin/snmpd
87
 
        log_progress_msg "snmpd"
 
84
        log_progress_msg " snmpd"
88
85
    fi
89
 
    log_end_msg 0
90
86
    ;;
91
87
  status)
92
 
        status_of_proc -p /var/run/snmpd.pid /usr/sbin/snmpd snmpd && exit 0 || exit $?
93
 
  ;;
 
88
    status=0
 
89
    status_of_proc /usr/sbin/snmpd snmpd || status=$?
 
90
    status_of_proc /usr/sbin/snmptrapd snmptrapd || status=$?
 
91
    exit $status
 
92
    ;;
94
93
  *)
95
94
    echo "Usage: /etc/init.d/snmpd {start|stop|restart|reload|force-reload|status}"
96
95
    exit 1