diff options
Diffstat (limited to 'www-apps/grafana-bin/files/grafana.initd.3')
-rw-r--r-- | www-apps/grafana-bin/files/grafana.initd.3 | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/www-apps/grafana-bin/files/grafana.initd.3 b/www-apps/grafana-bin/files/grafana.initd.3 new file mode 100644 index 000000000000..c454fb249753 --- /dev/null +++ b/www-apps/grafana-bin/files/grafana.initd.3 @@ -0,0 +1,38 @@ +#!/sbin/openrc-run +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +depend() { + need localmount +} + +start() { + ebegin "Starting grafana server" + + checkpath -d -o "${GRAFANA_USER}:${GRAFANA_GROUP}" -m750 "/var/lib/grafana/dashboards" + checkpath -d -o "${GRAFANA_USER}:${GRAFANA_GROUP}" -m750 "/var/lib/grafana/plugins" + checkpath -d -o "${GRAFANA_USER}:${GRAFANA_GROUP}" -m750 "/var/lib/grafana/sessions" + + start-stop-daemon --start -b \ + --make-pidfile \ + --pidfile /run/grafana.pid \ + --chdir /usr/share/grafana \ + --user ${GRAFANA_USER}:${GRAFANA_GROUP} \ + --exec /usr/bin/grafana-server -- \ + -config=/etc/grafana/grafana.ini \ + cfg:default.paths.data=/var/lib/grafana \ + cfg:default.paths.logs=/var/log/grafana + + eend $? +} + +stop() { + ebegin "Stopping grafana server" + + start-stop-daemon --stop \ + --pidfile /run/grafana.pid \ + --user "${GRAFANA_USER}" \ + --retry=TERM/20/KILL/5 + + eend $? +} |