#!/bin/sh

# PROVIDE: zoneminder
# REQUIRE: LOGIN mysql
# KEYWORD: shutdown
#
# Add these lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# zoneminder_enable (bool):     Set to NO by default.
#                               Set it to YES to enable zoneminder.

. /etc/rc.subr

name=zoneminder
rcvar=zoneminder_enable

load_rc_config $name

: ${zoneminder_enable="NO"}

command=%%PREFIX%%/bin/zmpkg.pl
pidfile=/var/run/zm/zm.pid
extra_commands="logrot version"

start_cmd="zm_cmd"
stop_cmd="zm_cmd"
status_cmd="zm_cmd"
logrot_cmd="zm_cmd"
version_cmd="zm_cmd"

zm_cmd() {
  ${command} ${rc_arg}
}

run_rc_command "$1"
