#!/bin/sh

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

stop() {
  if [ -f /var/run/saslauthd/saslauthd.pid ] ; then
    echo $"Stopping saslauthd..."
    kill `cat /var/run/saslauthd/saslauthd.pid`
    rm -f /var/run/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
