summaryrefslogtreecommitdiff
path: root/nonsystemd/vnstat-openrc/vnstatd.initd
diff options
context:
space:
mode:
Diffstat (limited to 'nonsystemd/vnstat-openrc/vnstatd.initd')
-rw-r--r--nonsystemd/vnstat-openrc/vnstatd.initd27
1 files changed, 27 insertions, 0 deletions
diff --git a/nonsystemd/vnstat-openrc/vnstatd.initd b/nonsystemd/vnstat-openrc/vnstatd.initd
new file mode 100644
index 000000000..c5e56479e
--- /dev/null
+++ b/nonsystemd/vnstat-openrc/vnstatd.initd
@@ -0,0 +1,27 @@
+#!/usr/bin/openrc-run
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+name="vnStat daemon"
+description="vnstatd updates vnStat databases."
+description_reload="Reload ${name}'s configuration"
+extra_started_commands="reload"
+
+VNSTATD_CONFIGFILE=${VNSTATD_CONFIGFILE:-"/etc/vnstat.conf"}
+VNSTATD_PIDFILE=${VNSTATD_PIDFILE:-"/run/vnstat/vnstatd.pid"}
+
+supervisor=supervise-daemon
+pidfile="${VNSTATD_PIDFILE}"
+command="/usr/bin/vnstatd"
+command_args="-n ${VNSTATD_OPTS} --config ${VNSTATD_CONFIGFILE}"
+required_files="${VNSTATD_CONFIGFILE}"
+
+start_pre() {
+ checkpath --directory --mode 0775 --owner vnstat:vnstat $(dirname "${pidfile}")
+}
+
+reload() {
+ ebegin "Reloading ${name} configuration"
+ supervisor-daemon vnstatd --signal HUP
+ eend $?
+}