]> git.pld-linux.org Git - packages/net-snmp.git/blame - net-snmptrapd.init
Provide hrMIB data via librpm for rpm 4.16
[packages/net-snmp.git] / net-snmptrapd.init
CommitLineData
43f17c64
AF
1#!/bin/sh
2#
3# ucd-snmptrapd Simple Network Management Protocol (SNMP) Trap Daemon
4#
5# chkconfig: 345 51 51
6#
7# description: Simple Network Management Protocol (SNMP) Trap Daemon
8#
9# processname: snmptrapd
10# config: /etc/snmp/snmptrapd.local.conf
11# config: /etc/snmp/snmptrapd.conf
12
13
14# Source function library
15. /etc/rc.d/init.d/functions
16
17# Get network config
18. /etc/sysconfig/network
19
eca273bc
PG
20# Define initial value:
21SNMPTRAPD_OPTIONS=""
22
43f17c64
AF
23# Get service config
24[ -f /etc/sysconfig/snmpd ] && . /etc/sysconfig/snmptrapd
25
26# Check that networking is up.
bde59677 27if is_yes "${NETWORKING}"; then
8d056991 28 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
bde59677 29 msg_network_down "snmptrapd"
30 exit 1
31 fi
32else
33 exit 0
43f17c64
AF
34fi
35
10206900 36start() {
43f17c64
AF
37 # Check if the service is already running?
38 if [ ! -f /var/lock/subsys/snmptrapd ]; then
39 msg_starting "snmptrapd"
eca273bc 40 daemon /usr/sbin/snmptrapd $SNMPTRAPD_OPTIONS
43f17c64
AF
41 RETVAL=$?
42 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/snmptrapd
43 else
44 msg_already_running "snmptrapd"
43f17c64 45 fi
10206900
ER
46}
47
48stop() {
43f17c64
AF
49 if [ -f /var/lock/subsys/snmptrapd ]; then
50 msg_stopping "snmptrapd"
51 killproc snmptrapd
52 rm -f /var/lock/subsys/snmptrapd >/dev/null 2>&1
53 else
54 msg_not_running "snmptrapd"
96268f66 55 fi
10206900
ER
56}
57
4eeb2c14
JB
58condrestart() {
59 if [ -f /var/lock/subsys/snmptrapd ]; then
60 stop
61 start
62 else
63 msg_not_running "snmptrapd"
64 RETVAL=$1
65 fi
66}
67
10206900
ER
68RETVAL=0
69# See how we were called.
70case "$1" in
71 start)
72 start
73 ;;
74 stop)
75 stop
43f17c64 76 ;;
4eeb2c14 77 restart)
10206900
ER
78 stop
79 start
43f17c64 80 ;;
4eeb2c14
JB
81 try-restart)
82 condrestart 0
83 ;;
84 force-reload)
85 condrestart 7
86 ;;
43f17c64
AF
87 status)
88 status snmptrapd
89 exit $?
90 ;;
91 *)
4eeb2c14 92 msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
04a4ae24 93 exit 3
43f17c64
AF
94esac
95
96exit $RETVAL
This page took 0.059502 seconds and 4 git commands to generate.