#!/bin/sh

# PROVIDE: callweaver
# REQUIRE: DAEMON
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable callweaver:
#
# callweaver_enable="YES"
#

. . /etc/rc.subr

stop_precmd=callweaver_shutdown
sig_stop=KILL

name=callweaver
rcvar=`set_rcvar`

command=/usr/local/sbin/${name}
pidfile=${callweaver_pidfile:-"/var/run/${name}.pid"}

load_rc_config $name

callweaver_enable=${callweaver_enable:-"NO"}

callweaver_shutdown () {
  /usr/local/sbin/${name} -qrx 'stop now'
  sleep 1
  return 0
}

run_rc_command "$1"
