]> git.pld-linux.org Git - packages/cyrus-sasl.git/blobdiff - saslauthd.init
- updated to 2.1.25
[packages/cyrus-sasl.git] / saslauthd.init
index 6fa6845a8f611f5b379c4382a8f5258d2d91a155..c610aaf4704ae62305791b781dc6fe1e52910f26 100644 (file)
 #!/bin/sh
 #
-# saslauthd    SASL AUTH Daemon
+# saslauthd            SASL AUTH Daemon
 #
 # chkconfig:   2345 40 60
+#
 # description: SASL AUTH Daemon
+#
 # processname: saslauthd
-# pidfile:     /var/state/sasl/mux.pid
-
+# pidfile:     /var/lib/sasl2/saslauthd.pid
+#
 # $Id$
 
 # Source function library
 . /etc/rc.d/init.d/functions
 
-# Get service config
+# Get network config
+. /etc/sysconfig/network
+
+# Check that networking is up.
+if is_yes "${NETWORKING}"; then
+       if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
+               msg_network_down "SASL AUTH Daemon"
+               exit 1
+       fi
+else
+       exit 0
+fi
+
+# Get service config - may override defaults
 [ -f /etc/sysconfig/saslauthd ] && . /etc/sysconfig/saslauthd
 
-if [ "x$SASL_AUTHMECH" != "x" ] ; then
+if [ "$SASL_AUTHMECH" ]; then
        SASLAUTHD_OPTS="$SASLAUTHD_OPTS -a $SASL_AUTHMECH"
 fi
 
-if [ "x$SASL_RIMAP_HOSTNAME" != "x" ] ; then
-       SASLAUTHD_OPTS="$SASLAUTHD_OPTS -H $SASL_RIMAP_HOSTNAME"
+if [ "$SASL_RIMAP_HOSTNAME" ]; then
+       SASLAUTHD_OPTS="$SASLAUTHD_OPTS -O $SASL_RIMAP_HOSTNAME"
 fi
 
-if is_yes "$SASL_TIME_OF_DAY_LOGIN_RESTRICTIONS" ; then
-       SASLAUTHD_OPTS="$SASLAUTHD_OPTS -T"
+if is_yes "$SASLAUTHD_CACHE"; then
+       SASLAUTHD_OPTS="$SASLAUTHD_OPTS -c"
 fi
 
+if [ "$SASLAUTHD_THREADS" ]; then
+       SASLAUTHD_OPTS="$SASLAUTHD_OPTS -n $SASLAUTHD_THREADS"
+fi
+
+start() {
+       # Check if the service is already running?
+       if [ -f /var/lock/subsys/saslauthd ]; then
+               msg_already_running "SASL AUTH Daemon"
+               return
+       fi
+
+       msg_starting "SASL AUTH Daemon"
+       daemon /usr/sbin/saslauthd $SASLAUTHD_OPTS
+       RETVAL=$?
+       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/saslauthd
+}
+
+stop() {
+       if [ ! -f /var/lock/subsys/saslauthd ]; then
+               msg_not_running "SASL AUTH Daemon"
+               return
+       fi
+
+       # Stop daemons.
+       msg_stopping "SASL AUTH Daemon"
+       killproc saslauthd
+       rm -f /var/lock/subsys/saslauthd /var/lib/sasl2/saslauthd.pid >/dev/null 2>&1
+}
+
+condrestart() {
+       if [ ! -f /var/lock/subsys/saslauthd ]; then
+               msg_not_running "SASL AUTH Daemon"
+               RETVAL=$1
+               return
+       fi
+
+       stop
+       start
+}
+
+RETVAL=0
 # See how we were called.
 case "$1" in
   start)
-       # Check if the service is already running?
-        if [ ! -f /var/lock/subsys/saslauthd ]; then
-               msg_starting salsauthd
-               daemon saslauthd $SASLAUTHD_OPTS
-               RETVAL=$?
-               [ $RETVAL -eq 0 ] && touch /var/lock/subsys/saslauthd
-       else
-               msg_already_running saslauthd
-               exit 1
-       fi
+       start
        ;;
   stop)
-        # Stop daemons.
-       if [ -f /var/lock/subsys/saslauthd ]; then
-                msg_stopping saslauthd
-                killproc saslauthd
-                rm -f /var/lock/subsys/saslauthd /var/run/saslauthd.pid >/dev/null 2>&1
-        else
-               msg_not_running saslauthd
-               exit 1
-       fi
+       stop
+       ;;
+  restart)
+       stop
+       start
+       ;;
+  try-restart)
+       condrestart 0
+       ;;
+  force-reload)
+       condrestart 7
        ;;
   status)
        status saslauthd
-       exit $?
-       ;;
-  restart|reload)
-       $0 stop
-       $0 start
+       RETVAL=$?
        ;;
   *)
-       msg_usage "$0 {start|stop|restart|status}"
-       exit 1
-       ;;
+       msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
+       exit 3
 esac
 
 exit $RETVAL
This page took 0.112804 seconds and 4 git commands to generate.