]> git.pld-linux.org Git - packages/net-snmp.git/blame - net-snmptrapd.init
- pass arguments to snmptrapd
[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
04a4ae24 36RETVAL=0
43f17c64
AF
37# See how we were called.
38case "$1" in
39 start)
40 # Check if the service is already running?
41 if [ ! -f /var/lock/subsys/snmptrapd ]; then
42 msg_starting "snmptrapd"
eca273bc 43 daemon /usr/sbin/snmptrapd $SNMPTRAPD_OPTIONS
43f17c64
AF
44 RETVAL=$?
45 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/snmptrapd
46 else
47 msg_already_running "snmptrapd"
43f17c64
AF
48 fi
49 ;;
50 stop)
51 if [ -f /var/lock/subsys/snmptrapd ]; then
52 msg_stopping "snmptrapd"
53 killproc snmptrapd
54 rm -f /var/lock/subsys/snmptrapd >/dev/null 2>&1
55 else
56 msg_not_running "snmptrapd"
43f17c64
AF
57 fi
58 ;;
04a4ae24 59 restart|force-reload)
43f17c64
AF
60 $0 stop
61 $0 start
04a4ae24 62 exit $?
43f17c64
AF
63 ;;
64 status)
65 status snmptrapd
66 exit $?
67 ;;
68 *)
04a4ae24 69 msg_usage "$0 {start|stop|restart|force-reload|status}"
70 exit 3
43f17c64
AF
71esac
72
73exit $RETVAL
This page took 0.057761 seconds and 4 git commands to generate.