#
# PROVIDE: weewx
# REQUIRE: DAEMON
#
# Add the following line to /etc/rc.conf.local or /etc/rc.conf
# to enable weewx:
#
# weewx_enable (bool): Set to NO by default
#                      Set it to YES to enable weewx
#

. /etc/rc.subr

name="weewx"
rcvar=weewx_enable

load_rc_config $name

start_cmd=weewx_start
weewx_daemon=/usr/local/etc/weewx/bin/weewxd
command=${weewx_daemon}
procname=${weewx_procname:-/usr/local/bin/python3}
weewx_pid=/var/run/weewx.pid
weewx_config=/usr/local/etc/weewx/weewx.conf

weewx_start() {
   echo "Starting ${name}."
   ${weewx_daemon} --daemon --pidfile=${weewx_pid} ${weewx_config} &
}

run_rc_command "$1"
