Changeset View
Changeset View
Standalone View
Standalone View
databases/kyototycoon/files/kyototycoon.in
#!/bin/sh | #!/bin/sh | ||||
# $FreeBSD$ | # $FreeBSD$ | ||||
# | # | ||||
# PROVIDE: kyototycoon | # PROVIDE: kyototycoon | ||||
# REQUIRE: LOGIN NETWORKING SERVERS | # REQUIRE: LOGIN NETWORKING SERVERS | ||||
# KEYWORD: shutdown | # KEYWORD: shutdown | ||||
# | |||||
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf | # Add the following lines to /etc/rc.conf.local or /etc/rc.conf | ||||
# to enable this service: | # to enable this service: | ||||
# | # | ||||
# kyototycoon_enable (bool): Set to NO by default. | # kyototycoon_enable (bool): Set to NO by default. | ||||
# Set it to YES to enable kyototycoon. | # Set it to YES to enable kyototycoon. | ||||
# | # | ||||
# kyototycoon_user (user): Set to kyototycoon by default. | # kyototycoon_user (user): Set to kyototycoon by default. | ||||
# kyototycoon_group (group): Set to kyototycoon by default. | # kyototycoon_group (group): Set to kyototycoon by default. | ||||
# kyototycoon_dbdir (path): Path to database files. | # kyototycoon_dbdir (path): Path to database files. | ||||
# kyototycoon_log (path): Path to log file. | # kyototycoon_log (path): Path to log file. | ||||
# kyototycoon_sid (int): ServerID - 0-65535 | # kyototycoon_sid (int): ServerID - 0-65535 | ||||
# kyototycoon_opts (args): Additional command-line arguments. | # kyototycoon_opts (args): Additional command-line arguments. | ||||
. /etc/rc.subr | . /etc/rc.subr | ||||
name=kyototycoon | |||||
name="kyototycoon" | |||||
rcvar=kyototycoon_enable | rcvar=kyototycoon_enable | ||||
desc="Replicating key-value datastore with HTTP and binary API" | |||||
load_rc_config $name | load_rc_config $name | ||||
: ${kyototycoon_enable="NO"} | : ${kyototycoon_enable:=NO} | ||||
: ${kyototycoon_user:="%%KYOTOTYCOON_USER%%"} | : ${kyototycoon_user:=%%KYOTOTYCOON_USER%%} | ||||
: ${kyototycoon_group:="%%KYOTOTYCOON_GROUP%%"} | : ${kyototycoon_group:=%%KYOTOTYCOON_GROUP%%} | ||||
: ${kyototycoon_dbdir="%%KYOTOTYCOON_DBDIR%%"} | : ${kyototycoon_dbdir=%%KYOTOTYCOON_DBDIR%%} | ||||
: ${kyototycoon_log="%%KYOTOTYCOON_LOGDIR%%/kyoto.log"} | : ${kyototycoon_log=%%KYOTOTYCOON_LOGDIR%%/kyoto.log} | ||||
: ${kyototycoon_sid="1"} | : ${kyototycoon_sid:=1} | ||||
: ${kyototycoon_opts:=" -li"} | : ${kyototycoon_opts=" -li"} | ||||
command="/usr/sbin/daemon" | command=/usr/sbin/daemon | ||||
command_args="-f -c -r -t ${name} -P ${pidfile} \ | command_args="-f -c -r -t ${name} -P ${pidfile} \ | ||||
%%PREFIX%%/bin/ktserver \ | %%PREFIX%%/bin/ktserver \ | ||||
-bgs ${kyototycoon_dbdir}/snapshots \ | -bgs ${kyototycoon_dbdir}/snapshots \ | ||||
-ulog ${kyototycoon_dbdir}/updates \ | -ulog ${kyototycoon_dbdir}/updates \ | ||||
-log ${kyototycoon_log} \ | -log ${kyototycoon_log} \ | ||||
-sid ${kyototycoon_sid} \ | -sid ${kyototycoon_sid} \ | ||||
${kyototycoon_opts}" | ${kyototycoon_opts}" | ||||
pidfile="%%KYOTOTYCOON_PIDFILE%%" | pidfile=%%KYOTOTYCOON_PIDFILE%% | ||||
required_dirs="${kyototycoon_dbdir}/snapshots ${kyototycoon_dbdir}/updates" | required_dirs="${kyototycoon_dbdir}/snapshots ${kyototycoon_dbdir}/updates" | ||||
required_files="${kyototycoon_log}" | required_files=${kyototycoon_log} | ||||
kyototycoon_prestart() | start_precmd="install -o ${kyototycoon_user} /dev/null ${pidfile}" | ||||
{ | |||||
install -o ${kyototycoon_user} /dev/null ${pidfile} | |||||
} | |||||
start_precmd=${name}_prestart | |||||
run_rc_command "$1" | run_rc_command "$1" |