]> git.pld-linux.org Git - packages/net-snmp.git/blame_incremental - net-snmptrapd.init
- evil typo
[packages/net-snmp.git] / net-snmptrapd.init
... / ...
CommitLineData
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
20# Define initial value:
21SNMPTRAPD_OPTIONS=""
22
23# Get service config
24[ -f /etc/sysconfig/snmpd ] && . /etc/sysconfig/snmptrapd
25
26# Check that networking is up.
27if is_yes "${NETWORKING}"; then
28 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
29 msg_network_down "snmptrapd"
30 exit 1
31 fi
32else
33 exit 0
34fi
35
36start() {
37 # Check if the service is already running?
38 if [ ! -f /var/lock/subsys/snmptrapd ]; then
39 msg_starting "snmptrapd"
40 daemon /usr/sbin/snmptrapd $SNMPTRAPD_OPTIONS
41 RETVAL=$?
42 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/snmptrapd
43 else
44 msg_already_running "snmptrapd"
45 fi
46}
47
48stop() {
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"
55 fi
56}
57
58RETVAL=0
59# See how we were called.
60case "$1" in
61 start)
62 start
63 ;;
64 stop)
65 stop
66 ;;
67 restart|force-reload)
68 stop
69 start
70 ;;
71 status)
72 status snmptrapd
73 exit $?
74 ;;
75 *)
76 msg_usage "$0 {start|stop|restart|force-reload|status}"
77 exit 3
78esac
79
80exit $RETVAL
This page took 0.023012 seconds and 4 git commands to generate.