blob: aeeedef74edef7f39c521b7d30b13a39f2951685 (
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: drizzle
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following line to /etc/rc.conf to enable drizzle:
# drizzle_enable (bool): Set to "NO" by default.
# Set it to "YES" to enable Drizzle.
# drizzle_limits (bool): Set to "NO" by default.
# Set it to yes to run `limits -e -U drizzle`
# just before drizzle starts.
# drizzle_dbdir (str): Default to "/var/db/drizzle"
# Base database directory.
# drizzle_log (str): Default to "/var/db/drizzle/<hostname>.log"
# Log file for startup messages (disable by
# setting to /dev/null)
# drizzle_args (str): Custom additional arguments to be passed
# to drizzle (default empty).
#
. /etc/rc.subr
name="drizzle"
rcvar=`set_rcvar`
load_rc_config $name
: ${drizzle_enable="NO"}
: ${drizzle_limits="NO"}
: ${drizzle_dbdir="/var/db/drizzle"}
: ${drizzle_log="${drizzle_dbdir}/`/bin/hostname`.log"}
drizzle_user="%%USERS%%"
drizzle_limits_args="-e -U ${drizzle_user}"
pidfile="${drizzle_dbdir}/`/bin/hostname`.pid"
command="%%PREFIX%%/sbin/drizzled"
command_args="--user=${drizzle_user} --datadir=${drizzle_dbdir} --pid-file=${pidfile} ${drizzle_args} > ${drizzle_log} 2>&1 &"
start_precmd="${name}_prestart"
start_postcmd="${name}_poststart"
drizzle_prestart()
{
if checkyesno drizzle_limits; then
eval `/usr/bin/limits ${drizzle_limits_args}` 2>/dev/null
else
return 0
fi
}
drizzle_poststart()
{
local timeout=15
while [ ! -f "${pidfile}" -a ${timeout} -gt 0 ]; do
timeout=$(( timeout - 1 ))
sleep 1
done
return 0
}
run_rc_command "$1"
|