diff options
| author | Daniil Baturin <daniil@baturin.org> | 2025-11-12 16:27:01 +0000 |
|---|---|---|
| committer | Daniil Baturin <daniil@baturin.org> | 2025-11-12 16:29:05 +0000 |
| commit | b327ec35caac1d62bda15144dcc14727b4b63c6a (patch) | |
| tree | 1e1a798f5197323cfd0362e79a1deab50b7dc458 | |
| parent | e6b170be4d34431558796b7f0388692322e67d45 (diff) | |
| download | vyos-1x-b327ec35caac1d62bda15144dcc14727b4b63c6a.tar.gz vyos-1x-b327ec35caac1d62bda15144dcc14727b4b63c6a.zip | |
misc: T8008: remove the last remnants of pmacct
| -rw-r--r-- | debian/vyos-1x.postinst | 2 | ||||
| -rwxr-xr-x | src/system/uacctd_stop.py | 68 |
2 files changed, 0 insertions, 70 deletions
diff --git a/debian/vyos-1x.postinst b/debian/vyos-1x.postinst index 9dd06d5e2..2b2d00d0f 100644 --- a/debian/vyos-1x.postinst +++ b/debian/vyos-1x.postinst @@ -224,10 +224,8 @@ fi # Remove unwanted daemon files from /etc # conntackd -# pmacct # ntp DELETE="/etc/logrotate.d/conntrackd.distrib /etc/init.d/conntrackd /etc/default/conntrackd - /etc/default/pmacctd /etc/pmacct /etc/ntp.conf /etc/default/ssh /etc/avahi/avahi-daemon.conf /etc/avahi/hosts /etc/powerdns /etc/default/pdns-recursor /etc/ppp/ip-up.d/0000usepeerdns /etc/ppp/ip-down.d/0000usepeerdns" diff --git a/src/system/uacctd_stop.py b/src/system/uacctd_stop.py deleted file mode 100755 index 2f0a4bb74..000000000 --- a/src/system/uacctd_stop.py +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright VyOS maintainers and contributors <maintainers@vyos.io> -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 or later as -# published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# Control pmacct daemons in a tricky way. -# Pmacct has signal processing in a main loop, together with packet -# processing. Because of this, while it is waiting for packets, it cannot -# handle the control signal. We need to start the systemctl command and then -# send some packets to pmacct to wake it up - -from argparse import ArgumentParser -from socket import socket, AF_INET, SOCK_DGRAM -from sys import exit -from time import sleep - -from psutil import Process - - -def stop_process(pid: int, timeout: int) -> None: - """Send a signal to uacctd - and then send packets to special address predefined in a firewall - to unlock main loop in uacctd and finish the process properly - - Args: - pid (int): uacctd PID - timeout (int): seconds to wait for a process end - """ - # find a process - uacctd = Process(pid) - uacctd.terminate() - - # create a socket - trigger = socket(AF_INET, SOCK_DGRAM) - - first_cycle: bool = True - while uacctd.is_running() and timeout: - print('sending a packet to uacctd...') - trigger.sendto(b'WAKEUP', ('127.0.254.0', 1)) - # do not sleep during first attempt - if not first_cycle: - sleep(1) - timeout -= 1 - first_cycle = False - - -if __name__ == '__main__': - parser = ArgumentParser() - parser.add_argument('process_id', - type=int, - help='PID file of uacctd core process') - parser.add_argument('timeout', - type=int, - help='time to wait for process end') - args = parser.parse_args() - stop_process(args.process_id, args.timeout) - exit() |
