#!/bin/sh

amavis_start() {
  if [ -x /usr/sbin/amavisd ]; then
    /usr/sbin/amavisd
  fi
}

amavis_stop() {
  killall -9 amavisd 2> /dev/null
}

amavis_restart() {
  killall -9 amavisd
  rm /var/amavis/amavisd.pid
  /usr/sbin/amavisd
}

case "$1" in
'start')
  amavis_start
  ;;
'stop')
  amavis_stop
  ;;
'restart')
  amavis_restart
  ;;
*)
  echo "usage $0 start|stop|restart"
esac
