ports/www/py-rhodecode/files/rhodecode.in
2013-09-03 18:56:27 +00:00

68 lines
1.5 KiB
Bash

#!/bin/sh
# $FreeBSD$
# PROVIDE: rhodecode
# REQUIRE: NETWORKING
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# rhodecode_enable (bool): Set to NO by default.
# Set it to YES to enable rhodecode.
# rhodecode_config (string):
# rhodecode config file for paster
# rhodecode_user (string):
# User to run rhodecode
# rhodecode_group (string):
# Group to run rhodecode
. /etc/rc.subr
name="rhodecode"
rcvar=rhodecode_enable
load_rc_config ${name}
: ${rhodecode_enable="NO"}
: ${rhodecode_config="%%PREFIX%%/etc/rhodecode/production.ini"}
: ${rhodecode_user="www"}
: ${rhodecode_group="www"}
pidfile="/var/run/${name}/${name}.pid"
logfile="/var/run/${name}.log"
command=%%PREFIX%%/bin/paster
start_precmd="install -d -o ${rhodecode_user} ${pidfile%/*} && install -o ${rhodecode_user} /dev/null ${logfile}"
start_cmd="rhodecode_start"
status_cmd="rhodecode_status"
stop_cmd="rhodecode_stop"
rhodecode_start() {
${command} serve \
--user=${rhodecode_user} \
--group=${rhodecode_group} \
--pid-file=${pidfile} \
--log-file=${logfile} \
--daemon \
${rhodecode_config}
}
rhodecode_status() {
${command} serve \
--pid-file=${pidfile}\
--status \
${rhodecode_config}
}
rhodecode_stop() {
${command} serve \
--user=${rhodecode_user} \
--group=${rhodecode_group} \
--pid-file=${pidfile} \
--stop-daemon \
${rhodecode_config}
}
required_files="${rhodecode_config}"
load_rc_config $name
run_rc_command "$1"