From 4f2d7949f03e1c198bc888f2d05f421d35c57e21 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Mon, 9 Oct 2017 18:53:29 +0100 Subject: reinit the tree, so we can have metadata --- net-analyzer/vnstat/files/vnstat.cron | 9 ++++++++ net-analyzer/vnstat/files/vnstat.cron-r1 | 7 ++++++ net-analyzer/vnstat/files/vnstatd.confd | 7 ++++++ net-analyzer/vnstat/files/vnstatd.confd-r1 | 18 +++++++++++++++ net-analyzer/vnstat/files/vnstatd.initd-r1 | 37 ++++++++++++++++++++++++++++++ net-analyzer/vnstat/files/vnstatd.initd-r2 | 29 +++++++++++++++++++++++ net-analyzer/vnstat/files/vnstatd.systemd | 11 +++++++++ net-analyzer/vnstat/files/vnstatd.tmpfile | 1 + 8 files changed, 119 insertions(+) create mode 100644 net-analyzer/vnstat/files/vnstat.cron create mode 100644 net-analyzer/vnstat/files/vnstat.cron-r1 create mode 100644 net-analyzer/vnstat/files/vnstatd.confd create mode 100644 net-analyzer/vnstat/files/vnstatd.confd-r1 create mode 100644 net-analyzer/vnstat/files/vnstatd.initd-r1 create mode 100644 net-analyzer/vnstat/files/vnstatd.initd-r2 create mode 100644 net-analyzer/vnstat/files/vnstatd.systemd create mode 100644 net-analyzer/vnstat/files/vnstatd.tmpfile (limited to 'net-analyzer/vnstat/files') diff --git a/net-analyzer/vnstat/files/vnstat.cron b/net-analyzer/vnstat/files/vnstat.cron new file mode 100644 index 000000000000..690681327688 --- /dev/null +++ b/net-analyzer/vnstat/files/vnstat.cron @@ -0,0 +1,9 @@ +#!/bin/bash + +# run vnstat if installed and at least one database exists + +# Uncomment the following to enable + +#if [ -x /usr/bin/vnstat ] && [ `ls /var/lib/vnstat/ | wc -l` -ge 1 ] ; then +# exec /usr/bin/vnstat -u +#fi diff --git a/net-analyzer/vnstat/files/vnstat.cron-r1 b/net-analyzer/vnstat/files/vnstat.cron-r1 new file mode 100644 index 000000000000..178133675c6f --- /dev/null +++ b/net-analyzer/vnstat/files/vnstat.cron-r1 @@ -0,0 +1,7 @@ +#!/bin/bash + +# run vnstat if installed and at least one database exists + +if [ -x /usr/bin/vnstat ] && [ `ls /var/lib/vnstat/ | wc -l` -ge 1 ] ; then + exec /usr/bin/vnstat -u +fi diff --git a/net-analyzer/vnstat/files/vnstatd.confd b/net-analyzer/vnstat/files/vnstatd.confd new file mode 100644 index 000000000000..17901419aacb --- /dev/null +++ b/net-analyzer/vnstat/files/vnstatd.confd @@ -0,0 +1,7 @@ +# /etc/conf.d/vnstatd: config file for /etc/init.d/vnstatd + +# Adjust scheduling priority on vnstatd (default: 0) +#VNSTATD_NICELEVEL="0" + +# Pass extra options to vnstatd +#VNSTATD_EXTRAOPTS="--config /etc/vnstat.conf" diff --git a/net-analyzer/vnstat/files/vnstatd.confd-r1 b/net-analyzer/vnstat/files/vnstatd.confd-r1 new file mode 100644 index 000000000000..33edf3560ee8 --- /dev/null +++ b/net-analyzer/vnstat/files/vnstatd.confd-r1 @@ -0,0 +1,18 @@ +# /etc/conf.d/vnstatd: config file for /etc/init.d/vnstatd + +# Configuration file +VNSTATD_CONFIGFILE="/etc/vnstat.conf" + +# PID file +VNSTATD_PIDFILE="/run/vnstat/vnstatd.pid" + +# Options to vnstatd +# See vnstatd(8) for more details +# Notes: +# * Do not specify another PIDFILE but use the variable above to change the location +# * Do not specify another CONFIGFILE but use the variable above to change the location +VNSTATD_OPTS="" + +# Wait x milliseconds after starting and check that daemon is still running. +# See start-stop-daemon(8) for more details +SSD_STARTWAIT=500 diff --git a/net-analyzer/vnstat/files/vnstatd.initd-r1 b/net-analyzer/vnstat/files/vnstatd.initd-r1 new file mode 100644 index 000000000000..a8d61efe0f2a --- /dev/null +++ b/net-analyzer/vnstat/files/vnstatd.initd-r1 @@ -0,0 +1,37 @@ +#!/sbin/openrc-run +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +extra_started_commands="reload" + +depend() { + use net +} + +VNSTATD_PIDFILE="${VNSTATD_PIDFILE:-/run/vnstatd/vnstatd.pid}" + +start() { + ebegin "Starting vnstatd" + checkpath -q -d -m 755 -o vnstat:vnstat /run/vnstatd + checkpath -q -d -m 755 -o vnstat:vnstat /var/lib/vnstat + start-stop-daemon --start --quiet \ + --pidfile "${VNSTATD_PIDFILE}" \ + --user vnstat --group vnstat \ + --nicelevel ${VNSTATD_NICELEVEL:-0} \ + --exec /usr/bin/vnstatd -- \ + -d ${VNSTATD_EXTRAOPTS} -p ${VNSTATD_PIDFILE} + eend $? +} + +stop() { + ebegin "Stopping vnstatd" + start-stop-daemon --stop --quiet \ + --pidfile "${VNSTATD_PIDFILE}" + eend $? +} + +reload() { + ebegin "Reloading vnstatd configuration" + kill -HUP $(cat "${VNSTATD_PIDFILE}") 2>&1 >/dev/null + eend $? +} diff --git a/net-analyzer/vnstat/files/vnstatd.initd-r2 b/net-analyzer/vnstat/files/vnstatd.initd-r2 new file mode 100644 index 000000000000..2b4a9336c2a5 --- /dev/null +++ b/net-analyzer/vnstat/files/vnstatd.initd-r2 @@ -0,0 +1,29 @@ +#!/sbin/openrc-run +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +extra_started_commands="reload" + +VNSTATD_CONFIGFILE=${VNSTATD_CONFIGFILE:-"/etc/vnstat.conf"} +VNSTATD_PIDFILE=${VNSTATD_PIDFILE:-"/run/vnstat/vnstatd.pid"} + +pidfile="${VNSTATD_PIDFILE}" +command="/usr/bin/vnstatd" +command_args="${VNSTATD_OPTS} --daemon --config \"${VNSTATD_CONFIGFILE}\" --pidfile \"${pidfile}\"" +start_stop_daemon_args="--wait ${SSD_STARTWAIT:-500}" +name="vnStat daemon" + +description="vnstatd updates vnStat databases." +description_reload="Reload ${name}'s configuration" + +required_files="${VNSTATD_CONFIGFILE}" + +start_pre() { + checkpath --directory --mode 0775 --owner vnstat:vnstat $(dirname "${pidfile}") +} + +reload() { + ebegin "Reloading ${name} configuration" + start-stop-daemon --signal HUP --pidfile "${pidfile}" + eend $? +} diff --git a/net-analyzer/vnstat/files/vnstatd.systemd b/net-analyzer/vnstat/files/vnstatd.systemd new file mode 100644 index 000000000000..51b079c5a9fb --- /dev/null +++ b/net-analyzer/vnstat/files/vnstatd.systemd @@ -0,0 +1,11 @@ +[Unit] +Description=vnStat network traffic monitor +Documentation=man:vnstatd(1) man:vnstat(1) man:vnstat.conf(5) +After=network-online.target + +[Service] +ExecStart=/usr/bin/vnstatd --nodaemon +ExecReload=/bin/kill -HUP $MAINPID + +[Install] +WantedBy=multi-user.target diff --git a/net-analyzer/vnstat/files/vnstatd.tmpfile b/net-analyzer/vnstat/files/vnstatd.tmpfile new file mode 100644 index 000000000000..36ecf2259495 --- /dev/null +++ b/net-analyzer/vnstat/files/vnstatd.tmpfile @@ -0,0 +1 @@ +d /run/vnstat 0775 vnstat vnstat - -- cgit v1.2.3