#!/bin/sh
# PROVIDE: pyweb
# REQUIRE: LOGIN NETWORKING
# KEYWORD: shutdown

. /etc/rc.subr

name="pyweb"
rcvar=pyweb_enable

pidfile="/var/run/pyweb.pid"
start_cmd="pyweb_start"
stop_cmd="pyweb_stop"

load_rc_config "$name"
: ${pyweb_enable="NO"}

pyweb_start()
{
    cd /usr/local/pyweb && /usr/sbin/daemon -S -r -P $pidfile /usr/local/bin/python3 /usr/local/pyweb/index.py
}

pyweb_stop()
{
    kill $(cat $pidfile)
}

run_rc_command "$1"
