aboutsummaryrefslogtreecommitdiff
path: root/databases/clickhouse/files
diff options
context:
space:
mode:
Diffstat (limited to 'databases/clickhouse/files')
-rw-r--r--databases/clickhouse/files/clickhouse.in62
1 files changed, 62 insertions, 0 deletions
diff --git a/databases/clickhouse/files/clickhouse.in b/databases/clickhouse/files/clickhouse.in
new file mode 100644
index 000000000000..7fa89c7129d5
--- /dev/null
+++ b/databases/clickhouse/files/clickhouse.in
@@ -0,0 +1,62 @@
+#!/bin/sh
+
+# $FreeBSD$
+#
+# 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_limits (bool): Set to "NO" by default.
+# Set it to yes to run `limits -e -U clickhouse`
+# just before clickhouse starts.
+# 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_limits="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_args="--server --config-file ${clickhouse_config} ${clickhouse_flags}"}
+
+command=/usr/sbin/daemon
+procname=/usr/local/bin/clickhouse
+pidfile=${clickhouse_rundir}/clickhouse.pid
+command_args="-c -f -p ${pidfile} ${procname} ${clickhouse_args}"
+required_files=${clickhouse_config}
+start_precmd=clickhouse_prestart
+
+clickhouse_prestart () {
+ if checkyesno clickhouse_limits; then
+ eval `/usr/bin/limits -e -U ${clickhouse_user}` 2>/dev/null
+ else
+ return 0
+ fi
+}
+
+run_rc_command "$1"