#!/bin/sh
#
# $FreeBSD: ports/japanese/Canna/files/canna.sh.in,v 1.7 2004/02/16 06:37:22 max Exp $
#

# PROVIDE: canna
# REQUIRE: DAEMON
# BEFORE: LOGIN
# KEYWORD: FreeBSD shutdown

# Define these canna_* variables in one of these files:
#	/etc/rc.conf
#	/etc/rc.conf.local
#	/etc/rc.conf.d/canna
#
# DO NOT CHANGE THESE DEFAULT VALUES HERE
#
canna_enable=${canna_enable:-"NO"}		# Enable canna
#canna_program="/usr/local/sbin/cannaserver"	# Location of canna
canna_flags=${canna_flags:-"-u bin"}		# Flags to canna program
# Put the following into /etc/rc.conf if you want to use a TCP
# connection instead of a UNIX domain socket.
#canna_flags="-u bin -inet"

. /etc/rc.subr

name="canna"
rcvar=`set_rcvar`
command="/usr/local/sbin/cannaserver"
start_precmd="canna_prestart"
stop_cmd="canna_stop"

canna_prestart() {
	/bin/rm -f /tmp/.iroha_unix/IROHA
	/usr/bin/touch /var/log/CANNA0msgs
	/usr/sbin/chown bin:bin /var/log/CANNA0msgs
}

canna_stop() {
	/usr/local/sbin/cannakill && echo "Stopping ${name}."
}

load_rc_config $name
run_rc_command "$1"
