#!/bin/sh
#
# saslauthd         This shell script takes care of starting and stopping
#              saslauthd.
#
# chkconfig: 2345 50 10
# description: saslauthd is the Sasl authentication daemon.

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

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

[ -x /usr/sbin/saslauthd ] || exit 0

# See how we were called.
case "$1" in
  start)
        # Start daemons.
	echo -n "Starting Sasl authentication daemon: "
	saslauthd -a pam &
	evaluate_retval
	echo
        touch /var/lock/subsys/saslauthd
        ;;
  stop)
        # Stop daemons.
	echo -n "Stopping Sasl authentication daemon: "
	killproc saslauthd
	evaluate_retval
	echo
        rm -f /var/lock/subsys/saslauthd
        ;;
  status)
	status saslauthd
        ;;
  restart)
        $0 stop
        $0 start
        ;;
  reload)
        $0 stop
        $0 start
        ;;
  condrestart)
    if [ -f /var/lock/subsys/saslauthd ]; then
        $0 stop
        $0 start
    fi
    ;;
  *)
        echo "Usage: saslauthd {start|stop|restart|status}"
        exit 1
esac

exit 0
