[arch-commits] Commit in cyrus-sasl/trunk (saslauthd)

Jan de Groot jgc at archlinux.org
Wed Aug 3 19:32:29 UTC 2011


    Date: Wednesday, August 3, 2011 @ 15:32:29
  Author: jgc
Revision: 134418

Improve init script a bit

Modified:
  cyrus-sasl/trunk/saslauthd

-----------+
 saslauthd |   21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

Modified: saslauthd
===================================================================
--- saslauthd	2011-08-03 19:24:16 UTC (rev 134417)
+++ saslauthd	2011-08-03 19:32:29 UTC (rev 134418)
@@ -8,33 +8,32 @@
 
 DAEMON_NAME="saslauthd"
 SASLAUTHD_BIN=/usr/sbin/saslauthd
-SASLAUTHD_PID=`pidof -o %PPID $SASLAUTHD_BIN`
+SASLAUTHD_RUN=/var/run/saslauthd
+SASLAUTHD_PID=$SASLAUTHD_RUN/saslauthd.pid
 
 case "$1" in
   start)
     stat_busy "Starting $DAEMON_NAME"
-    [ -z "$SASLAUTHD_PID" ] && $SASLAUTHD_BIN $SASLAUTHD_OPTS
-    if [ $? -gt 0 ]; then
+    [ ! -d /var/run/saslauthd ] && install -d /var/run/saslauthd
+    if $SASLAUTHD_BIN $SASLAUTHD_OPTS >/dev/null; then
+      add_daemon $DAEMON_NAME
+      stat_done
+    else
       stat_fail
       exit 1
-    else
-      echo `pidof -o %PPID $SASLAUTHD_BIN` > /var/run/$DAEMON_NAME.pid
     fi
-    add_daemon $DAEMON_NAME
-    stat_done
     ;;
 
   stop)
     stat_busy "Stopping $DAEMON_NAME"
-    [ ! -z "$SASLAUTHD_PID" ]  && kill $SASLAUTHD_PID &> /dev/null
+    [ -f $SASLAUTHD_PID ] && kill `cat $SASLAUTHD_PID` &>/dev/null
     if [ $? -gt 0 ]; then
       stat_fail
       exit 1
     else
-      rm /var/run/$DAEMON_NAME.pid &> /dev/null
+      rm_daemon $DAEMON_NAME
+      stat_done
     fi
-    rm_daemon $DAEMON_NAME
-    stat_done
     ;;
 
   restart)




More information about the arch-commits mailing list