#!/bin/sh
#
# $NetBSD: redmine_unicorn.sh,v 1.1 2026/02/11 07:53:37 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-redmine61
	/usr/pkg/bin/bundle33 exec /usr/pkg/bin/unicorn33 \
		-c /usr/pkg/share/ruby33-redmine61/config/unicorn.rb \
		-E production -D
}

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

load_rc_config $name
run_rc_command "$1"
