summaryrefslogtreecommitdiff
path: root/dev-db/cockroach/files/cockroach.initd-1.0
diff options
context:
space:
mode:
authorWilliam Hubbs <williamh@gentoo.org>2017-05-16 18:55:16 -0500
committerWilliam Hubbs <williamh@gentoo.org>2017-05-16 18:55:58 -0500
commit6133bdf8265e1eb9db8892e7d164f3c8932aba98 (patch)
tree9dd0278b97a1ad8911726350d759478b54391eb5 /dev-db/cockroach/files/cockroach.initd-1.0
parent30cde42da94f3c296fa5edc249a41e3b12911cc7 (diff)
downloadgentoo-6133bdf8265e1eb9db8892e7d164f3c8932aba98.tar.gz
gentoo-6133bdf8265e1eb9db8892e7d164f3c8932aba98.tar.bz2
gentoo-6133bdf8265e1eb9db8892e7d164f3c8932aba98.zip
dev-db/cockroach: 1.0-r1 revbump for new service scripts
This revbump adds new service scripts which expose several of the arguments for cockroach in variables which can be set in the conf.d file. Package-Manager: Portage-2.3.5, Repoman-2.3.1
Diffstat (limited to 'dev-db/cockroach/files/cockroach.initd-1.0')
-rw-r--r--dev-db/cockroach/files/cockroach.initd-1.060
1 files changed, 60 insertions, 0 deletions
diff --git a/dev-db/cockroach/files/cockroach.initd-1.0 b/dev-db/cockroach/files/cockroach.initd-1.0
new file mode 100644
index 000000000000..b2b4f6a0884f
--- /dev/null
+++ b/dev-db/cockroach/files/cockroach.initd-1.0
@@ -0,0 +1,60 @@
+#!/sbin/openrc-run
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+command=/usr/bin/cockroach
+pidfile=/run/${RC_SVCNAME}/cockroach.pid
+start_stop_daemon_args="--quiet --user cockroach"
+[ -n "${attrs}" ] && attrs_arg="--attrs=${attrs}"
+[ -n "${cache}" ] && cache_arg="--cache=${cache}"
+[ -n "${certs_path}" ] && certs_dir_arg="--certs-dir=${certs_path}"
+[ "${host}" != all ] && host_arg="--host=${host:-localhost}"
+[ "$http_host" != all ] && http_host_arg="--http-host=${http_host:-localhost}"
+[ -n "${http_port}" ] && http_port_arg="--http-port=${http_port}"
+yesno "${insecure:-yes}" && insecure_arg="--insecure"
+[ -n "${join}" ] && join_arg="--join=${join}"
+[ -n "${locality}" ] && locality_arg="--locality=\"${locality}\""
+log_path="${log_path:-/var/log/${RC_SVCNAME}}"
+[ -n "${log_path}" ] && log_dir_arg="--log-dir=${log_path}"
+ pidfile_arg="--pid-file=${pidfile}"
+[ -n "${port}" ] && port_arg="--port=${port}"
+store_arg="--store=${store:-/var/lib/cockroach/data}"
+command_args="start --background
+ ${attrs_arg}
+ ${cache_arg}
+ ${certs_dir_arg}
+ ${host_arg}
+ ${http_host_arg}
+ ${http_port_arg}
+ ${insecure_arg}
+ ${join_arg}
+ ${locality_arg}
+ ${log_dir_arg}
+ ${pidfile_arg}
+ ${port_arg}
+ ${store_arg}
+ ${start_args}"
+quit_args="
+ ${certs_dir_arg}
+ ${host_arg}
+ ${insecure_arg}
+ ${port_arg}
+ "
+
+depend() {
+ use net
+}
+
+start_pre() {
+ if [ -n "${log_path}" ]; then
+ checkpath -d -m 0755 -o cockroach:cockroach "${log_path}" ||
+ return 1
+ fi
+ checkpath -d -m 0755 -o cockroach:cockroach "$(dirname ${pidfile})"
+}
+
+stop() {
+ebegin "bringing down ${RC_SVCNAME}"
+eval ${command} quit ${quit_args} ${stop_args}
+eend $?
+}