Sophie

Sophie

distrib > Mandriva > 10.2 > x86_64 > by-pkgid > 3e04b7d31f42717df60d59bd6f91342c > files > 12

cyrus-sasl-2.1.19-12.1.102mdk.src.rpm

#!/bin/sh
#
# saslauthd     SASL AUTH Daemon
#
# chkconfig:    2345 40 60
# description:  SASL AUTH Daemon
# processname:  saslauthd
# pidfile:      /var/lock/subsys/saslauthd

# $Id: saslauthd.init,v 1.1 2001/05/02 10:55:48 wiget Exp $

# Source function library
. /etc/rc.d/init.d/functions

#Mux file directory
MUXDIR="/var/lib/sasl2"

#Postfix spool directory (need to have the mux there as well)
PFDIR="/var/spool/postfix"


# Get service config
[ -f /etc/sysconfig/saslauthd ] && . /etc/sysconfig/saslauthd

# mech_options must be specified before the auth method

if [ "x$SASL_MECH_OPTIONS" != "x" ] ; then
	SASLAUTHD_OPTS="$SASLAUTHD_OPTS -O $SASL_MECH_OPTIONS"
fi

# compatibility with previous versions
if [ "x$SASL_RIMAP_HOSTNAME" != "x" ] ; then
	SASLAUTHD_OPTS="$SASLAUTHD_OPTS -O $SASL_RIMAP_HOSTNAME"
fi

if [ "x$SASL_AUTHMECH" != "x" ] ; then
	SASLAUTHD_OPTS="$SASLAUTHD_OPTS -a $SASL_AUTHMECH"
fi


# See how we were called.
case "$1" in
  start)
	# Check if the service is already running?
        if [ ! -f /var/lock/subsys/saslauthd ]; then
		gprintf "Starting saslauthd"
		daemon saslauthd $SASLAUTHD_OPTS
		echo
	        RETVAL=$?
    		[ $RETVAL -eq 0 ] && touch /var/lock/subsys/saslauthd
	else
        	gprintf "saslauthd already running"
		echo
	        exit 1
	fi
	# Check if Postfix is present and make a hardlink so
        # smtp auth can work
	if [ -e $PFDIR -a ! -e $PFDIR$MUXDIR ]; then
		echo "Creating $PFDIR$MUXDIR"
		mkdir -p $PFDIR$MUXDIR
	fi
        if [ ! -e $PFDIR$MUXDIR/mux ];then
		if [ ! -e $MUXDIR/mux ];then
		  gprintf "Mux not ready... Sleeping 1 second\n"
		  sleep 1
		fi
		echo "Creating hardlink from $MUXDIR/mux to $PFDIR$MUXDIR/"
		ln -f $MUXDIR/mux $PFDIR$MUXDIR/
	fi
	;;
  stop)
        # Stop daemons.
	if [ -f /var/lock/subsys/saslauthd ]; then
                gprintf "Stopping saslauthd"
                killproc saslauthd
		echo
                rm -f /var/lock/subsys/saslauthd /var/run/saslauthd.pid >/dev/null 2>&1
        else
		gprintf "saslauthd not running"
		echo
	        exit 1
	fi
        if [ -e $PFDIR$MUXDIR/mux ];then
		echo "Deleting $PFDIR$MUXDIR/mux"
		rm -f $PFDIR$MUXDIR/mux
	fi
	;;
  status)
	status saslauthd
	exit $?
	;;
  restart|reload)
	$0 stop
	$0 start
	;;
  *)
	gprintf "%s {start|stop|restart|status}\n" "$0"
	exit 1
	;;
esac

exit $RETVAL