#!/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" | grep -v "up-to-date" } run_rc_command "$1"