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

View File

@ -9,6 +9,18 @@
# config: /usr/share/snmp/snmpd.conf # config: /usr/share/snmp/snmpd.conf
# pidfile: /var/run/snmpd.pid # 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 # source function library
. /etc/init.d/functions . /etc/init.d/functions
@ -20,14 +32,17 @@ fi
RETVAL=0 RETVAL=0
prog="snmpd" prog="snmpd"
binary=/usr/sbin/snmpd
pidfile=/var/run/snmpd.pid
start() { start() {
[ -x $binary ] || exit 5
echo -n $"Starting $prog: " echo -n $"Starting $prog: "
if [ $UID -ne 0 ]; then if [ $UID -ne 0 ]; then
RETVAL=1 RETVAL=1
failure failure
else else
daemon /usr/sbin/snmpd $OPTIONS daemon --pidfile=$pidfile $binary $OPTIONS
RETVAL=$? RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/snmpd [ $RETVAL -eq 0 ] && touch /var/lock/subsys/snmpd
fi; fi;
@ -41,7 +56,7 @@ stop() {
RETVAL=1 RETVAL=1
failure failure
else else
killproc /usr/sbin/snmpd killproc -p $pidfile $binary
RETVAL=$? RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/snmpd [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/snmpd
fi; fi;
@ -51,7 +66,7 @@ stop() {
reload(){ reload(){
echo -n $"Reloading $prog: " echo -n $"Reloading $prog: "
killproc /usr/sbin/snmpd -HUP killproc -p $pidfile $binary -HUP
RETVAL=$? RETVAL=$?
echo echo
return $RETVAL return $RETVAL
@ -70,18 +85,23 @@ condrestart(){
case "$1" in case "$1" in
start) start)
start start
RETVAL=$?
;; ;;
stop) stop)
stop stop
RETVAL=$?
;; ;;
restart) restart)
restart restart
RETVAL=$?
;; ;;
reload) reload)
reload reload
RETVAL=$?
;; ;;
condrestart) condrestart|try-restart)
condrestart condrestart
RETVAL=$?
;; ;;
status) status)
status snmpd status snmpd
@ -89,7 +109,7 @@ case "$1" in
;; ;;
*) *)
echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}" echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
RETVAL=1 RETVAL=2
esac esac
exit $RETVAL exit $RETVAL

View File

@ -9,7 +9,20 @@
# config: /etc/snmp/snmptrapd.conf # config: /etc/snmp/snmptrapd.conf
# config: /usr/share/snmp/snmptrapd.conf # config: /usr/share/snmp/snmptrapd.conf
# pidfile: /var/run/snmptrapd.pid # 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 # source function library
. /etc/init.d/functions . /etc/init.d/functions
@ -21,10 +34,13 @@ fi
RETVAL=0 RETVAL=0
prog="snmptrapd" prog="snmptrapd"
binary=/usr/sbin/snmptrapd
pidfile=/var/run/snmptrapd.pid
start() { start() {
[ -x $binary ] || exit 5
echo -n $"Starting $prog: " echo -n $"Starting $prog: "
daemon /usr/sbin/snmptrapd $OPTIONS daemon --pidfile=$pidfile /usr/sbin/snmptrapd $OPTIONS
RETVAL=$? RETVAL=$?
echo echo
touch /var/lock/subsys/snmptrapd touch /var/lock/subsys/snmptrapd
@ -33,7 +49,7 @@ start() {
stop() { stop() {
echo -n $"Stopping $prog: " echo -n $"Stopping $prog: "
killproc /usr/sbin/snmptrapd killproc -p $pidfile /usr/sbin/snmptrapd
RETVAL=$? RETVAL=$?
echo echo
rm -f /var/lock/subsys/snmptrapd rm -f /var/lock/subsys/snmptrapd
@ -58,18 +74,23 @@ condrestart(){
case "$1" in case "$1" in
start) start)
start start
RETVAL=$?
;; ;;
stop) stop)
stop stop
RETVAL=$?
;; ;;
restart) restart)
restart restart
RETVAL=$?
;; ;;
reload) reload)
reload reload
RETVAL=$?
;; ;;
condrestart) condrestart|try-restart)
condrestart condrestart
RETVAL=$?
;; ;;
status) status)
status snmptrapd status snmptrapd
@ -77,7 +98,7 @@ case "$1" in
;; ;;
*) *)
echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}" echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
RETVAL=1 RETVAL=2
esac esac
exit $RETVAL exit $RETVAL