mirror of
https://git.freebsd.org/ports.git
synced 2025-06-26 23:20:30 -04:00
literal name_enable wherever possible, and ${name}_enable when it's not, to prepare for the demise of set_rcvar(). In cases where I had to hand-edit unusual instances also modify formatting slightly to be more uniform (and in some cases, correct). This includes adding some $FreeBSD$ tags, and most importantly moving rcvar= to right after name= so it's clear that one is derived from the other.
51 lines
1.2 KiB
Bash
51 lines
1.2 KiB
Bash
#!/bin/sh
|
|
#
|
|
# PROVIDE: cruisecontrolrb
|
|
# REQUIRE: DAEMON
|
|
# KEYWORD: shutdown
|
|
#
|
|
# This script is modified by placing the following variables inside
|
|
# /etc/rc.conf.local, /etc/rc.conf, or /etc/rc.conf.d/cruisecontrolrb:
|
|
#
|
|
# cruisecontrolrb_enable (bool): Set it to YES to enable this service.
|
|
# Default: NO
|
|
# cruisecontrolrb_port (port): Set it to a port
|
|
# Default: 3333
|
|
|
|
. /etc/rc.subr
|
|
|
|
name=cruisecontrolrb
|
|
rcvar=cruisecontrolrb_enable
|
|
|
|
homedir="%%PREFIX%%/www/${name}"
|
|
pidfile="${homedir}/tmp/pids/mongrel.pid"
|
|
command="./cruise"
|
|
|
|
start_cmd="cruisecontrolrb_start"
|
|
stop_cmd="cruisecontrolrb_stop"
|
|
|
|
cruisecontrolrb_start() {
|
|
cd ${homedir} && ${command} start ${command_args}
|
|
}
|
|
cruisecontrolrb_stop() {
|
|
if [ -f $pidfile ]; then
|
|
kill $(cat $pidfile)
|
|
fi
|
|
## also stop the builders
|
|
if [ -d %%PREFIX%%/www/${name}/tmp/pids/builders ]; then
|
|
cd %%PREFIX%%/www/${name}/tmp/pids/builders
|
|
for builder in $(ls); do
|
|
kill $(cat $builder)
|
|
rm ${builder}
|
|
done
|
|
fi
|
|
}
|
|
|
|
load_rc_config $name
|
|
|
|
: ${cruisecontrolrb_enable="NO"}
|
|
: ${cruisecontrolrb_port="3333"}
|
|
|
|
command_args="-p ${cruisecontrolrb_port} -d"
|
|
|
|
run_rc_command "$1"
|