#!/bin/sh
#
# $NetBSD: mosquitto.sh,v 1.7 2023/10/06 14:21:35 triaxx Exp $
#
# PROVIDE: mosquitto
# REQUIRE: DAEMON

$_rc_subr_loaded . /etc/rc.subr

name="mosquitto"
rcvar=$name

load_rc_config $name

: ${mosquitto_user:=mosquitto}

command="/usr/pkg/sbin/${name}"
command_args="-d -c /usr/pkg/etc/${name}.conf"

piddir="/var/run/${name}"
pidfile="${piddir}/${name}.pid"

start_precmd="mosquitto_precmd"
test_cmd="mosquitto_test"
extra_commands=""

mosquitto_precmd()
{
    mkdir -p ${piddir}
    chown ${mosquitto_user} ${piddir}
}

run_rc_command "$1"
