blob: f058335c875dd4d35eea5f95d11d81cd3216c08d (
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
|
#!/bin/sh
# PROVIDE: clickhouse
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following line to /etc/rc.conf[.local] to enable clickhouse server
#
# clickhouse_enable (bool): Set to "NO" by default
# Set it to "YES" to enable clickhouse server
# clickhouse_config (str): Path to config file (required).
# (default: %%PREFIX%%/etc/clickhouse-server/config.xml)
# clickhouse_rundir (str): Path to directory holding a pidfile.
# (default: /var/run/clickhouse)
# clickhouse_user (str): User to run as
# (default: clickhouse)
# clickhouse_group (str): Group to run as
# (default: clickhouse)
# clickhouse_logdir (str): Path to log directory
# (default: /var/log/clickhouse)
# clickhouse_dbdir (str): Path to world database directory
# (default: /var/db/clickhouse)
. /etc/rc.subr
name=clickhouse
rcvar=clickhouse_enable
load_rc_config ${name}
: ${clickhouse_enable="NO"}
: ${clickhouse_config="%%PREFIX%%/etc/clickhouse-server/config.xml"}
: ${clickhouse_rundir="/var/run/clickhouse"}
: ${clickhouse_user="clickhouse"}
: ${clickhouse_group="clickhouse"}
: ${clickhouse_logdir="/var/log/clickhouse"}
: ${clickhouse_dbdir="/var/db/clickhouse"}
: ${clickhouse_flags=""}
: ${clickhouse_pidfile="${clickhouse_rundir}/clickhouse.pid"}
: ${clickhouse_args="--server --daemon --pid-file ${clickhouse_pidfile} --config-file ${clickhouse_config} ${clickhouse_flags}"}
command=%%PREFIX%%/bin/clickhouse
pidfile=${clickhouse_pidfile}
command_args=${clickhouse_args}
required_files=${clickhouse_config}
start_precmd=clickhouse_prestart
clickhouse_prestart () {
for _dir in ${clickhouse_rundir} ${clickhouse_logdir} ${clickhouse_dbdir}; do
install -d -o ${clickhouse_user} -g ${clickhouse_group} ${_dir}
done
return 0
}
run_rc_command "$1"
|