#!/bin/sh

# $FreeBSD: ports/mail/archiveopteryx/files/archiveopteryx.in,v 1.2 2012/01/14 08:55:52 dougb Exp $
#
# PROVIDE: archiveopteryx
# REQUIRE: login
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# archiveopteryx_enable (bool):	Set to NO by default.
#	Set it to YES to enable archiveopteryx.
#

. /etc/rc.subr

name="archiveopteryx"
rcvar=archiveopteryx_enable

archiveopteryx_enable=${archiveopteryx_enable:-"NO"}
pidfile=/var/run/${name}.pid
config_file=/usr/local/etc/archiveopteryx/archiveopteryx.conf
required_files=$config_file

command=/usr/local/bin/aox
extra_commands="status"
status_cmd="do_status"
start_cmd="do_start"
stop_cmd="do_stop"
restart_cmd="do_restart"

do_start()
{
    echo -n "Starting Archiveopteryx: "
    ${command} start
    echo "done."
}

do_stop()
{
    echo -n "Stopping Archiveopteryx: "
    ${command} stop
    echo "done."
}

do_restart()
{
    echo -n "Restarting Archiveopteryx: "
    ${command} restart
    echo "done."
}

do_status()
{
    ${command} show status
}

load_rc_config $name
run_rc_command "$1"
