#!/bin/sh

start() {
    if [ -x /usr/sbin/saslauthd ]; then
        echo $"Starting saslauthd..."
        /usr/sbin/saslauthd -a shadow
    fi
}

stop() {
    if [ -r /var/state/saslauthd/saslauthd.pid ]; then
        echo $"Stopping saslauthd..."
        kill `cat /var/state/saslauthd/saslauthd.pid`
        rm -f /var/state/saslauthd/saslauthd.pid
    fi
}

case "$1" in
start)
    start
    ;;
stop)
    stop
    ;;
restart)
    stop
    sleep 3
    start
    ;;
*)
    echo $"Usage: $0 {start|stop|restart}"
    exit 1
    ;;
esac

exit 0
