#!/bin/sh

# PROVIDE: semaphore
# REQUIRE: mysql
# KEYWORD: shutdown

. /etc/rc.subr

name=semaphore
rcvar=semaphore_enable

load_rc_config ${name}

: ${semaphore_enable:="NO"}
: ${semaphore_config="/usr/local/etc/semaphore/semaphore_config.json"}

export PATH=${PATH}:/usr/local/bin

pidfile="/var/run/${name}.pid"
procname="/usr/local/bin/semaphore"
command="/usr/sbin/daemon"
command_args="-f -c -p ${pidfile} /usr/bin/env ${semaphore_env} ${procname} -config \"${semaphore_config}\""

run_rc_command "$1"
