#!/bin/sh -e

PATH=/sbin:/bin:/usr/sbin:/usr/bin
NAME=roundup
DESC="roundup server"
if [ "x$1" = "x-d" ]; then
    shift
    SERVICE="$1"
    shift
else
    SERVICE=/var/service/$NAME
fi

if [ -d "$SERVICE" ]; then
    case "$1" in
      start|stop|reload|force-reload|restart|status)
        sv -v "$1" ${NAME}
	;;
      *)
	echo "Usage: roundup-ctl {start|stop|restart|reload|force-reload|status}" >&2
	exit 3
	;;
    esac
else
    echo "roundup-ctl: $SERVICE is not a directory"
    exit 1
fi
exit 0
