From de28cb2036af6e7786ff54f1732d3a33439442e8 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 26 Dec 2021 10:01:22 +0100 Subject: flow-accounting: T4097: move configuration file to /run --- src/conf_mode/flow_accounting_conf.py | 6 ++++-- src/etc/systemd/system/uacctd.service.d/override.conf | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 src/etc/systemd/system/uacctd.service.d/override.conf (limited to 'src') diff --git a/src/conf_mode/flow_accounting_conf.py b/src/conf_mode/flow_accounting_conf.py index 74d304493..e01f3066b 100755 --- a/src/conf_mode/flow_accounting_conf.py +++ b/src/conf_mode/flow_accounting_conf.py @@ -34,7 +34,7 @@ from vyos import ConfigError from vyos import airbag airbag.enable() -uacctd_conf_path = '/etc/pmacct/uacctd.conf' +uacctd_conf_path = '/run/pmacct/uacctd.conf' iptables_nflog_table = 'raw' iptables_nflog_chain = 'VYATTA_CT_PREROUTING_HOOK' egress_iptables_nflog_table = 'mangle' @@ -252,8 +252,10 @@ def apply(flow_config): _iptables_config([], 'ingress') _iptables_config([], 'egress') - # Stop flow-accounting daemon + # Stop flow-accounting daemon and remove configuration file cmd('systemctl stop uacctd.service') + if os.path.exists(uacctd_conf_path): + os.unlink(uacctd_conf_path) return # Start/reload flow-accounting daemon diff --git a/src/etc/systemd/system/uacctd.service.d/override.conf b/src/etc/systemd/system/uacctd.service.d/override.conf new file mode 100644 index 000000000..38bcce515 --- /dev/null +++ b/src/etc/systemd/system/uacctd.service.d/override.conf @@ -0,0 +1,14 @@ +[Unit] +After= +After=vyos-router.service +ConditionPathExists= +ConditionPathExists=/run/pmacct/uacctd.conf + +[Service] +EnvironmentFile= +ExecStart= +ExecStart=/usr/sbin/uacctd -f /run/pmacct/uacctd.conf +WorkingDirectory= +WorkingDirectory=/run/pmacct +PIDFile= +PIDFile=/run/pmacct/uacctd.pid -- cgit v1.2.3