aboutsummaryrefslogtreecommitdiff
path: root/www/rubygem-mongrel_cluster/files/mongrel_cluster.in
blob: 5a6c96fb580c56164036311d1da02a942f11cfa4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/sh
# PROVIDE: mongrel_cluster
# 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/mongrel_cluster:
#
# mongrel_cluster_enable (bool):
# 	Set it to YES to enable this service.
#	Default: NO
# mongrel_cluster_conf_dir (path):
# 	The directory containing the configuration file (*.yml) for each
#	application you want to control.
# 	Default: %%PREFIX%%/etc/mongrel_cluster

. %%RC_SUBR%%

name=mongrel_cluster
rcvar=${name}_enable

command="%%PREFIX%%/bin/mongrel_cluster_ctl"

load_rc_config $name

: ${mongrel_cluster_enable="NO"}
: ${mongrel_cluster_conf_dir="%%ETCDIR%%"}

command_args="-c ${mongrel_cluster_conf_dir}"
start_cmd="mongrel_cmd start"
stop_cmd="mongrel_cmd stop"
restart_cmd="mongrel_cmd restart"
status_cmd="mongrel_cmd status"

mongrel_cmd()
{
    if [ ! -d "${mongrel_cluster_conf_dir}/." ]; then
	warn "${mongrel_cluster_conf_dir} is not a directory."
	return 1
    fi
    ${command} $1 ${mongrel_cluster_flags} ${command_args} 2>&1 | grep -v "procfs"
}

run_rc_command "$1"