51 lines
1.2 KiB
Bash
51 lines
1.2 KiB
Bash
#!/bin/sh
|
|
|
|
# PROVIDE: reaction
|
|
# REQUIRE: LOGIN
|
|
# KEYWORD: shutdown
|
|
#
|
|
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
|
|
# to enable this service:
|
|
#
|
|
# reaction_enable (bool): Set to NO by default.
|
|
# Set it to YES to enable reaction.
|
|
# reaction_args (string): Set extra arguments to pass to reaction
|
|
# Default is "".
|
|
# reaction_config (string): Set reaction configuration file
|
|
# Default is "/usr/local/etc/reaction.yml".
|
|
|
|
. /etc/rc.subr
|
|
|
|
name=reaction
|
|
rcvar=reaction_enable
|
|
|
|
load_rc_config $name
|
|
|
|
: ${reaction_enable:="NO"}
|
|
: ${reaction_args:=""}
|
|
: ${reaction_config:="/usr/local/etc/reaction/reaction.yml"}
|
|
: ${reaction_restart_delay:=3}
|
|
|
|
pidfile=/var/run/reaction/reaction.pid
|
|
command="/usr/sbin/daemon"
|
|
reaction_command="%%PREFIX%%/bin/reaction start"
|
|
command_args="-rP ${pidfile} -S -R ${reaction_restart_delay} \
|
|
-T ${name} ${reaction_command} \
|
|
-c ${reaction_config}"
|
|
required_files="${reaction_config}"
|
|
|
|
start_precmd=reaction_prestart
|
|
|
|
# put db in /var/run/reaction/
|
|
reaction_prestart()
|
|
{
|
|
if [ ! -e /var/run/reaction ]; then
|
|
mkdir -p /var/run/reaction
|
|
fi
|
|
cd /var/run/reaction/
|
|
}
|
|
|
|
|
|
load_rc_config $name
|
|
run_rc_command "$1"
|