From 2771f79232c273bc2a57d23bf335dd81ccf6af28 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 5 Dec 2021 02:47:11 +0000 Subject: gentoo resync : 05.12.2021 --- net-firewall/nfacct/files/nfacct.initd | 42 ++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 net-firewall/nfacct/files/nfacct.initd (limited to 'net-firewall/nfacct/files/nfacct.initd') diff --git a/net-firewall/nfacct/files/nfacct.initd b/net-firewall/nfacct/files/nfacct.initd new file mode 100644 index 000000000000..ac5eeaa33aba --- /dev/null +++ b/net-firewall/nfacct/files/nfacct.initd @@ -0,0 +1,42 @@ +#!/sbin/openrc-run +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +extra_commands="save" + +NFACCT_SAVE=${NFACCT_SAVE:-/var/lib/nfacct/counters-save} + +depend() { + before iptables ip6tables +} + +checkconfig() { + if [ ! -f "${NFACCT_SAVE}" ] ; then + eerror "Not starting ${SVCNAME}. First create some counters then run:" + eerror "/etc/init.d/${SVCNAME} save" + return 1 + fi + return 0 +} + +start() { + checkconfig || return 1 + ebegin "Loading nfacct counters" + nfacct restore < "${NFACCT_SAVE}" + eend $? +} + +stop() { + if [ "${SAVE_ON_STOP}" = "yes" ] ; then + save || return 1 + fi + ebegin "Removing nfacct counters" + nfacct flush + eend $? +} + +save() { + ebegin "Saving nfacct counters" + nfacct list > "${NFACCT_SAVE}" + eend $? +} -- cgit v1.2.3