summaryrefslogtreecommitdiff
path: root/app-text/groonga/files/groonga.initd
diff options
context:
space:
mode:
Diffstat (limited to 'app-text/groonga/files/groonga.initd')
-rw-r--r--app-text/groonga/files/groonga.initd20
1 files changed, 20 insertions, 0 deletions
diff --git a/app-text/groonga/files/groonga.initd b/app-text/groonga/files/groonga.initd
new file mode 100644
index 000000000000..7d11ab6f7984
--- /dev/null
+++ b/app-text/groonga/files/groonga.initd
@@ -0,0 +1,20 @@
+#!/sbin/openrc-run
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+command=/usr/bin/groonga
+command_args="-d --pid-path ${GROONGA_PID:-/run/groonga/groonga.pid} --config-path=${CONFIG_FILE:-/etc/groonga/groonga.conf} ${DATABASE}"
+pidfile="${GROONGA_PID:-/run/groonga/groonga.pid}"
+start_stop_daemon_args="--quiet --user ${GROONGA_USER:-groonga}:${GROONGA_GROUP:-groonga}"
+
+depend() {
+ use net
+}
+
+start_pre() {
+ checkpath -d /run/groonga -o ${GROONGA_USER:-groonga}:${GROONGA_GROUP:-groonga}
+ if [ ! -e "${DATABASE}" ] ; then
+ einfo "Creating database ${DATABASE}"
+ su -s /bin/sh -c "/usr/bin/groonga -n ${DATABASE} quit" ${GROONGA_USER:-groonga}
+ fi
+}