[Pkg-cyrus-sasl2-commits] r627 - in /cyrus-sasl-2.1/trunk/debian: changelog sasl2-bin.saslauthd.init

roberto at users.alioth.debian.org roberto at users.alioth.debian.org
Mon Mar 14 20:01:18 UTC 2011


Author: roberto
Date: Mon Mar 14 20:01:12 2011
New Revision: 627

URL: http://svn.debian.org/wsvn/pkg-cyrus-sasl2/?sc=1&rev=627
Log:
Allow getting saslauthd status with '/etc/init.d/saslauthd status'.
Thanks to Raoul Bhatia for the patch (Closes: #589181)

Modified:
    cyrus-sasl-2.1/trunk/debian/changelog
    cyrus-sasl-2.1/trunk/debian/sasl2-bin.saslauthd.init

Modified: cyrus-sasl-2.1/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-cyrus-sasl2/cyrus-sasl-2.1/trunk/debian/changelog?rev=627&op=diff
==============================================================================
--- cyrus-sasl-2.1/trunk/debian/changelog (original)
+++ cyrus-sasl-2.1/trunk/debian/changelog Mon Mar 14 20:01:12 2011
@@ -13,8 +13,10 @@
     Thanks to Matthias Klose for the patch (Closes: #609237)
   * Drop gratuitous dependency on krb5support (Closes: #528238)
   * Ship docs on testing with sasl-sample-{client,server} (Closes: #516542)
-
- -- Roberto C. Sanchez <roberto at connexer.com>  Sun, 13 Mar 2011 22:05:43 -0400
+  * Allow getting saslauthd status with '/etc/init.d/saslauthd status'.
+    Thanks to Raoul Bhatia for the patch (Closes: #589181)
+
+ -- Roberto C. Sanchez <roberto at connexer.com>  Mon, 14 Mar 2011 15:59:28 -0400
 
 cyrus-sasl2 (2.1.23.dfsg1-7) unstable; urgency=low
 

Modified: cyrus-sasl-2.1/trunk/debian/sasl2-bin.saslauthd.init
URL: http://svn.debian.org/wsvn/pkg-cyrus-sasl2/cyrus-sasl-2.1/trunk/debian/sasl2-bin.saslauthd.init?rev=627&op=diff
==============================================================================
--- cyrus-sasl-2.1/trunk/debian/sasl2-bin.saslauthd.init (original)
+++ cyrus-sasl-2.1/trunk/debian/sasl2-bin.saslauthd.init Mon Mar 14 20:01:12 2011
@@ -64,6 +64,17 @@
 	done
 }
 
+# Function that sends a SIG0 to all saslauthd instances
+# Parameters: none
+# Return value: none
+do_checkall()
+{
+	for instance in $DEFAULT_FILES
+	do
+		check_instance $instance
+	done
+}
+
 # Function that starts a single saslauthd instance
 # Parameters:
 #	$1 = path of default file for this instance
@@ -268,6 +279,52 @@
 	start-stop-daemon --stop --signal 1 \
 		--pidfile $PIDFILE --exec $DAEMON
 	log_end_msg $?
+}
+
+# Function that sends a SIG0 to a single saslauthd instance
+# Parameters:
+#	$1 = path of default file for this instance
+# Return value:
+#	0 on success (does not mean the daemon was reloaded)
+#	other values on failure
+check_instance()
+{
+	# Load defaults file for this instance.
+	. $1
+
+	# If the short name of this instance is undefined, warn the user
+	# but choose a default name.
+	if [ -z "$NAME" ]; then
+		log_warning_msg "Short name (NAME) undefined in $1, using default"
+		NAME=default
+	fi
+
+	# Determine run directory and pid file location by looking
+	# for an -m option.
+	RUN_DIR=`echo "$OPTIONS" | xargs -n 1 echo | sed -n '/^-m$/{n;p}'`
+	if [ -z "$RUN_DIR" ]; then
+		# No run directory defined in defaults file, fail.
+        log_failure_msg "No run directory defined for $NAME, cannot check"
+		return 2
+	fi
+	PIDFILE=$RUN_DIR/saslauthd.pid
+
+	log_daemon_msg "Checking $DESC" "$NAME"
+
+	# Reload the daemon. First, see if it is already running.
+	start-stop-daemon --start --quiet --pidfile $PIDFILE \
+		--exec $DAEMON --test > /dev/null
+
+	if [ "$?" -eq "0" ]; then
+		# Not running, signal this and stop.
+		log_progress_msg "(not running)"
+		log_end_msg 3
+		return 3
+	fi
+
+	log_progress_msg "(running)"
+	log_end_msg $?
+	return 0
 }
 
 # Function that creates a directory with the specified
@@ -299,6 +356,10 @@
 		do_stopall
 		do_startall
 		;;
+	status)
+		do_checkall
+		exit $?
+		;;
 	start-instance)
 		if [ -f /etc/default/$2 ]; then
 			start_instance /etc/default/$2




More information about the Pkg-cyrus-sasl2-commits mailing list