Sophie

Sophie

distrib > Mageia > 1 > x86_64 > by-pkgid > 072c5e81f53183525c00c8d70a842eb2 > files > 2

net-snmp-trapd-5.6.1-7.1.mga1.x86_64.rpm

#!/bin/bash
# net-snmp init file for snmptrapd
#
# chkconfig: - 50 50
# description: Simple Network Management Protocol (SNMP) Trap Daemon
#
# processname: /usr/sbin/snmptrapd
# config: /etc/snmp/snmptrapd.conf
# config: /usr/share/snmp/snmptrapd.conf
# pidfile: /var/run/snmptrapd.pid

### BEGIN INIT INFO
# Provides: snmptrap
# Required-Start: $network $remote_fs
# Required-Stop: $network $remote_fs
# Default-Start: 3 4 5
# Short-Description: SNMP trap daemon
# Description: Simple Network Management Protocol (SNMP) Trap Daemon
### END INIT INFO

# source function library
. /etc/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

[ -x /usr/sbin/snmptrapd -a -f /etc/snmp/snmptrapd.conf ] || exit 0

if [ -r /etc/sysconfig/snmptrapd ]; then
    . /etc/sysconfig/snmptrapd
else
    OPTIONS="-Lsd -p /var/run/snmptrapd.pid"
fi

RETVAL=0
prog="snmptrapd"

start() {
	gprintf "Starting %s: " "$prog"
        daemon /usr/sbin/snmptrapd $OPTIONS
	RETVAL=$?
	echo
	touch /var/lock/subsys/snmptrapd
	return $RETVAL
}

stop() {
	gprintf "Stopping %s: " "$prog"
	killproc /usr/sbin/snmptrapd
	RETVAL=$?
	echo
	rm -f /var/lock/subsys/snmptrapd
	return $RETVAL
}

reload(){
	stop
	start
}

restart(){
	stop
	start
}

condrestart(){
    [ -e /var/lock/subsys/snmptrapd ] && restart
    return 0
}

case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  restart)
	restart
        ;;
  reload)
	reload
        ;;
  condrestart)
	condrestart
	;;
  status)
        status snmptrapd
	RETVAL=$?
        ;;
  *)
	gprintf "Usage: %s {start|stop|status|restart|condrestart|reload}\n" "$0"
	RETVAL=1
esac

exit $RETVAL