#!/bin/sh
#
# $NetBSD: snapserver.sh,v 1.2 2022/07/06 10:02:14 nia Exp $
#
# PROVIDE: snapserver
# KEYWORD: shutdown
#

if [ -f /etc/rc.subr ]
then
	. /etc/rc.subr
fi

name="snapserver"
rcvar=${name}
command="/usr/pkg/bin/snapserver"
command_args="-d"
pidfile="/var/run/snapserver/pid"
start_precmd="snapserver_precmd"

snapserver_precmd()
{
	if [ ! -d "/var/run/snapserver" ]; then
		mkdir -p -m 755 "/var/run/snapserver"
		chown snapserver:snapserver "/var/run/snapserver"
	fi
}

load_rc_config $name
run_rc_command "$1"
