#!/bin/sh

case $1 in
	start)
		if [ -e /var/etc/.tuxmaild ]; then
			echo "starting tuxmaild ..."
			tuxmaild
			sleep 1
		fi
	;;
	stop)
		if [ -e /var/etc/.tuxmaild ]; then
			echo "stopping tuxmaild ..."
			pid=$(cat /var/run/tuxmail.pid 2>/dev/null)
			test -n "$pid" && kill $pid || true
		fi
	;;
	*)
		echo "[${0##*/}] Usage: $0 {start|stop}"
	;;
esac
