[Glibc-bsd-commits] r4331 - trunk/istgt/debian

Arno Töll atoell-guest at alioth.debian.org
Tue Jun 26 22:25:54 UTC 2012


Author: atoell-guest
Date: 2012-06-26 22:25:53 +0000 (Tue, 26 Jun 2012)
New Revision: 4331

Modified:
   trunk/istgt/debian/changelog
   trunk/istgt/debian/init
Log:
Improve init script: Better support fancy outputs; Improve failure toleance of the reload handler; Log istgt start output to syslog; prepare for upload

Modified: trunk/istgt/debian/changelog
===================================================================
--- trunk/istgt/debian/changelog	2012-06-26 21:27:44 UTC (rev 4330)
+++ trunk/istgt/debian/changelog	2012-06-26 22:25:53 UTC (rev 4331)
@@ -1,14 +1,17 @@
-istgt (0.4~20111008-3) UNRELEASED; urgency=low
+istgt (0.4~20111008-3) unstable; urgency=low
 
-  * NOT RELEASED YET
   * Fix "cannot determine device size from symlink" Apply patch to use stat()
     instead of lstat(). Thanks Michal Suchanek  (Closes: #650212). I apologize
     for the delay, but I was postponing this decision for a long time, given
     it was rejected by upstream for security concerns. I do not share these.
   * Fix "Add support to reload the istgt.conf file." by merging the excellent
     patch Andrew Ruthven <andrew at etc.gen.nz>. Much appreciated (Closes: #679055)
+  * Improve init script:
+    + Better support fancy outputs
+    + Improve failure toleance of the reload handler
+    + Log istgt start output to syslog
 
- -- Arno Töll <arno at debian.org>  Tue, 26 Jun 2012 23:25:04 +0200
+ -- Arno Töll <arno at debian.org>  Wed, 27 Jun 2012 00:23:23 +0200
 
 istgt (0.4~20111008-2) unstable; urgency=low
 

Modified: trunk/istgt/debian/init
===================================================================
--- trunk/istgt/debian/init	2012-06-26 21:27:44 UTC (rev 4330)
+++ trunk/istgt/debian/init	2012-06-26 22:25:53 UTC (rev 4331)
@@ -15,6 +15,7 @@
 DESC="istgt iSCSI target"
 NAME=istgt
 DAEMON=/usr/sbin/istgt
+ISTGTCONTROL=/usr/sbin/istgtcontrol
 PIDFILE=/var/run/$NAME.pid
 DAEMON_ARGS="-c /etc/istgt/istgt.conf -p $PIDFILE"
 SCRIPTNAME=/etc/init.d/$NAME
@@ -50,13 +51,13 @@
 	start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
 		|| return 1
 	start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
-		$DAEMON_ARGS \
+		$DAEMON_ARGS  2>&1 | logger -p daemon.info \
 		|| return 2
 
 	RETVAL=0
 	for i in 1 2 3 4 5 ; do
 		sleep 1
-		status_of_proc -p $PIDFILE "$DAEMON" "$NAME" || RETVAL=$?
+		pidofproc -p $PIDFILE "$DAEMON" "$NAME" > /dev/null || RETVAL=$?
 		[ "$RETVAL" = 0 ] && return 0
 	done
 
@@ -89,7 +90,10 @@
 # Function that sends a SIGHUP to the daemon/service
 #
 do_reload() {
-	istgtcontrol refresh
+	[ -x $ISTGTCONTROL ] || return 127
+	pidofproc -p $PIDFILE $NAME > /dev/null || return 2
+	$ISTGTCONTROL refresh > /dev/null 2>&1
+	return $?
 }
 
 case "$1" in
@@ -113,8 +117,20 @@
     [ "$VERBOSE" != no ] && log_daemon_msg "Reloading $DESC " "$NAME"
     do_reload
     case "$?" in
-		0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
-		2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+		0)
+			[ "$VERBOSE" != no ] && log_end_msg 0
+			;;
+		2)
+			[ "$VERBOSE" != no ] && log_end_msg 1
+			[ "$VERBOSE" != no ] && log_warning_msg "$NAME is not running"
+			;;
+		127)
+			[ "$VERBOSE" != no ] && log_end_msg 1
+			[ "$VERBOSE" != no ] && log_warning_msg "$ISTGTCONTROL not found"
+			;;
+		*)
+			[ "$VERBOSE" != no ] && log_end_msg 1
+			;;
 	esac
   ;;
   status)




More information about the Glibc-bsd-commits mailing list