#!/bin/sh
#
# $NetBSD: redmine60_unicorn.sh,v 1.1 2024/12/13 17:19:28 taca Exp $
#

# PROVIDE: redmine60_unicorn33
# REQUIRE: DAEMON
# KEYWORD: shutdown

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

name="redmine60_unicorn33"
rcvar=$name
start_cmd="redmine60_unicorn_start"
stop_cmd="redmine60_unicorn_stop"

redmine60_unicorn_start()
{
	cd /usr/pkg/share/ruby33-redmine60
	/usr/pkg/bin/bundle33 exec /usr/pkg/bin/unicorn33 \
		-c /usr/pkg/share/ruby33-redmine60/config/unicorn.rb \
		-E production -D
}

redmine60_unicorn_stop()
{
	/bin/kill -QUIT `/bin/cat /usr/pkg/share/ruby33-redmine60/unicorn.pid`
}

load_rc_config $name
run_rc_command "$1"
