Line 0
Link Here
|
|
|
1 |
#!/bin/sh |
2 |
|
3 |
# $FreeBSD$ |
4 |
# |
5 |
# PROVIDE: kyototycoon |
6 |
# REQUIRE: LOGIN NETWORKING SERVERS |
7 |
# KEYWORD: shutdown |
8 |
# |
9 |
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf |
10 |
# to enable this service: |
11 |
# |
12 |
# kyototycoon_enable (bool): Set to NO by default. |
13 |
# Set it to YES to enable kyototycoon. |
14 |
# |
15 |
# kyototycoon_user (user): Set to kyototycoon by default. |
16 |
# kyototycoon_group (group): Set to kyototycoon by default. |
17 |
# kyototycoon_log (path): Path to log file. |
18 |
# kyototycoon_dbdir (path): Path to database files. |
19 |
# kyototycoon_sid (int): ServerID - 0-65535 |
20 |
# kyototycoon_opts (args): Additional command-line arguments. |
21 |
. /etc/rc.subr |
22 |
|
23 |
name="kyototycoon" |
24 |
rcvar=kyototycoon_enable |
25 |
|
26 |
load_rc_config $name |
27 |
|
28 |
: ${kyototycoon_enable="NO"} |
29 |
: ${kyototycoon_user:="%%KYOTOTYCOON_USER%%"} |
30 |
: ${kyototycoon_group:="%%KYOTOTYCOON_GROUP%%"} |
31 |
: ${kyototycoon_log="%%KYOTOTYCOON_LOGDIR%%/kyoto.log"} |
32 |
: ${kyototycoon_dbdir="%%KYOTOTYCOON_DBDIR%%"} |
33 |
: ${kyototycoon_sid="1"} |
34 |
: ${kyototycoon_opts:=" -li"} |
35 |
|
36 |
pidfile="%%KYOTOTYCOON_PIDFILE%%" |
37 |
command="/usr/sbin/daemon" |
38 |
command_args="-f -c -r -t ${name} -P ${pidfile} \ |
39 |
%%PREFIX%%/bin/ktserver \ |
40 |
-sid ${kyototycoon_sid} \ |
41 |
-log ${kyototycoon_log} \ |
42 |
-bgs ${kyototycoon_dbdir}/snapshots \ |
43 |
-ulog ${kyototycoon_dbdir}/updates \ |
44 |
${kyototycoon_opts}" |
45 |
|
46 |
required_dirs="${kyototycoon_dbdir}/snapshots ${kyototycoon_dbdir}/updates" |
47 |
required_files="${kyototycoon_log}" |
48 |
|
49 |
kyototycoon_prestart() |
50 |
{ |
51 |
install -o ${kyototycoon_user} /dev/null ${pidfile} |
52 |
} |
53 |
start_precmd=${name}_prestart |
54 |
|
55 |
run_rc_command "$1" |