#!/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 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 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 ]; then if [ ! -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 fi ;; stop) # Stop daemons. if [ -f /var/lock/subsys/saslauthd ]; then gprintf "Stopping saslauthd" killproc saslauthd RETVAL=$? echo if [ "$RETVAL" -eq "0" ]; then rm -f /var/lock/subsys/saslauthd /var/run/saslauthd.pid >/dev/null 2>&1 if [ -e ${PFDIR}${MUXDIR}/mux ]; then echo "Deleting ${PFDIR}${MUXDIR}/mux" rm -f ${PFDIR}${MUXDIR}/mux fi fi else gprintf "saslauthd not running" echo exit 1 fi ;; status) status saslauthd RETVAL=$? ;; restart|reload) $0 stop $0 start RETVAL=$? ;; *) gprintf "%s {start|stop|restart|status}\n" "$0" exit 1 ;; esac exit $RETVAL