init scripts made LSB compliant Resolves: #246995

This commit is contained in:
Jan Šafránek 2008-01-28 12:49:25 +00:00
parent cc7405e8ff
commit 56fb3a58a6
3 changed files with 55 additions and 11 deletions

View File

@ -7,7 +7,7 @@
Summary: A collection of SNMP protocol tools and libraries
Name: net-snmp
Version: %{major_ver}
Release: 7%{?dist}
Release: 8%{?dist}
Epoch: 1
License: BSD and CMU
@ -379,6 +379,9 @@ rm -rf ${RPM_BUILD_ROOT}
%{_libdir}/lib*.so.*
%changelog
* Mon Jan 28 2008 Jan Safranek <jsafranek@redhat.com> 5.4.1-8
- init scripts made LSB compliant
* Wed Dec 5 2007 Jan Safranek <jsafranek@redhat.com> 5.4.1-7
- rebuild for openssl soname bump

View File

@ -9,6 +9,18 @@
# config: /usr/share/snmp/snmpd.conf
# pidfile: /var/run/snmpd.pid
### BEGIN INIT INFO
# Provides: snmpd
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Should-Start:
# Should-Stop:
# Default-Start:
# Default-Stop:
# Short-Description: start and stop Net-SNMP daemon
# Description: Simple Network Management Protocol (SNMP) Daemon
### END INIT INFO
# source function library
. /etc/init.d/functions
@ -20,14 +32,17 @@ fi
RETVAL=0
prog="snmpd"
binary=/usr/sbin/snmpd
pidfile=/var/run/snmpd.pid
start() {
[ -x $binary ] || exit 5
echo -n $"Starting $prog: "
if [ $UID -ne 0 ]; then
RETVAL=1
failure
else
daemon /usr/sbin/snmpd $OPTIONS
daemon --pidfile=$pidfile $binary $OPTIONS
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/snmpd
fi;
@ -41,7 +56,7 @@ stop() {
RETVAL=1
failure
else
killproc /usr/sbin/snmpd
killproc -p $pidfile $binary
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/snmpd
fi;
@ -51,7 +66,7 @@ stop() {
reload(){
echo -n $"Reloading $prog: "
killproc /usr/sbin/snmpd -HUP
killproc -p $pidfile $binary -HUP
RETVAL=$?
echo
return $RETVAL
@ -70,18 +85,23 @@ condrestart(){
case "$1" in
start)
start
RETVAL=$?
;;
stop)
stop
RETVAL=$?
;;
restart)
restart
RETVAL=$?
;;
reload)
reload
RETVAL=$?
;;
condrestart)
condrestart|try-restart)
condrestart
RETVAL=$?
;;
status)
status snmpd
@ -89,7 +109,7 @@ case "$1" in
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
RETVAL=1
RETVAL=2
esac
exit $RETVAL

View File

@ -9,7 +9,20 @@
# config: /etc/snmp/snmptrapd.conf
# config: /usr/share/snmp/snmptrapd.conf
# pidfile: /var/run/snmptrapd.pid
#
### BEGIN INIT INFO
# Provides: snmptrapd
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Should-Start:
# Should-Stop:
# Default-Start:
# Default-Stop:
# Short-Description: start and stop Net-SNMP trap daemon
# Description: Simple Network Management Protocol (SNMP) trap daemon
### END INIT INFO
# source function library
. /etc/init.d/functions
@ -21,10 +34,13 @@ fi
RETVAL=0
prog="snmptrapd"
binary=/usr/sbin/snmptrapd
pidfile=/var/run/snmptrapd.pid
start() {
[ -x $binary ] || exit 5
echo -n $"Starting $prog: "
daemon /usr/sbin/snmptrapd $OPTIONS
daemon --pidfile=$pidfile /usr/sbin/snmptrapd $OPTIONS
RETVAL=$?
echo
touch /var/lock/subsys/snmptrapd
@ -33,7 +49,7 @@ start() {
stop() {
echo -n $"Stopping $prog: "
killproc /usr/sbin/snmptrapd
killproc -p $pidfile /usr/sbin/snmptrapd
RETVAL=$?
echo
rm -f /var/lock/subsys/snmptrapd
@ -58,18 +74,23 @@ condrestart(){
case "$1" in
start)
start
RETVAL=$?
;;
stop)
stop
RETVAL=$?
;;
restart)
restart
RETVAL=$?
;;
reload)
reload
RETVAL=$?
;;
condrestart)
condrestart|try-restart)
condrestart
RETVAL=$?
;;
status)
status snmptrapd
@ -77,7 +98,7 @@ case "$1" in
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
RETVAL=1
RETVAL=2
esac
exit $RETVAL