SOURCES: openlldp-lldp.init - use start-stop-daemon for better pid...

glen glen at pld-linux.org
Wed Jan 23 09:42:35 CET 2008


Author: glen                         Date: Wed Jan 23 08:42:35 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- use start-stop-daemon for better pidfile capture, by Ilja Bobkevič

---- Files affected:
SOURCES:
   openlldp-lldp.init (1.2 -> 1.3) 

---- Diffs:

================================================================
Index: SOURCES/openlldp-lldp.init
diff -u SOURCES/openlldp-lldp.init:1.2 SOURCES/openlldp-lldp.init:1.3
--- SOURCES/openlldp-lldp.init:1.2	Tue Jan 22 13:40:34 2008
+++ SOURCES/openlldp-lldp.init	Wed Jan 23 09:42:29 2008
@@ -35,8 +35,8 @@
 	if [ ! -f /var/lock/subsys/lldpd ]; then
 		msg_starting lldpd
 		# Default debug switch "n". Default log file /var/log/lldpd.log
-		# For now force to background. Need to patch code for daemonizing
-		/usr/sbin/lldpd -d ${LLDP_DEBUG:-n} >> "${LLDP_LOG_FILE:-/var/log/lldpd.log}" &
+		# For now use start-stop-daemon. Need to patch code for daemonizing
+		start-stop-daemon --start --background --pidfile /var/run/lldpd.pid --make-pidfile --exec /usr/sbin/lldpd -- -d ${LLDP_DEBUG:-n} >> "${LLDP_LOG_FILE:-/var/log/lldpd.log}"
 		RETVAL=$?
 		[ $RETVAL -eq 0 ] && touch /var/lock/subsys/lldpd
 		ok
@@ -49,9 +49,9 @@
 	# Stop daemons.
 	if [ -f /var/lock/subsys/lldpd ]; then
 		msg_stopping lldpd
-		rm -f /var/lock/subsys/lldpd
-		# Doesn't generate any pidfile, so just kill'em'all
-		killall -9 lldpd
+		start-stop-daemon --stop --pidfile /var/run/lldpd.pid --name lldpd
+		rm -f /var/lock/subsys/lldpd /var/run/lldpd.pid
+		ok
 	else
 		msg_not_running lldpd
 	fi
@@ -61,17 +61,21 @@
 # See how we were called.
 case "$1" in
   start)
-  	start
+	start
 	;;
   stop)
-  	stop
+	stop
+	;;
+  restart)
+	stop
+	start
 	;;
   status)
 	status lldpd
 	RETVAL=$?
 	;;
   *)
-	msg_usage "$0 {start|stop|status}"
+	msg_usage "$0 {start|stop|restart|status}"
 	exit 3
 	;;
 esac
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/openlldp-lldp.init?r1=1.2&r2=1.3&f=u



More information about the pld-cvs-commit mailing list