#!/bin/sh

saslauth_start() {
  if [ -x /usr/sbin/saslauthd ]; then
    /usr/sbin/saslauthd -a shadow
  fi
}

saslauth_stop() {
  killall saslauthd 2> /dev/null
}

saslauth_restart() {
  killall -9 saslauthd
  sleep 1
  /usr/sbin/saslauthd -a shadow
}

case "$1" in
'start')
  saslauth_start
  ;;
'stop')
  saslauth_stop
  ;;
'restart')
  saslauth_restart
  ;;
*)
  echo "usage $0 start|stop|restart"
esac
