From d8d5ddf555a436f9353945106fd9cb4e083624f5 Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 12 Sep 2021 11:19:07 +0100 Subject: [PATCH] Expose process titles in ps (not just python3!) --- bridge_master.py | 9 +++++++++ hotspot_proxy_v2.py | 9 +++++++-- playback.py | 4 ++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/bridge_master.py b/bridge_master.py index 13d1827..d600cf9 100755 --- a/bridge_master.py +++ b/bridge_master.py @@ -38,6 +38,7 @@ from time import time,sleep,perf_counter import importlib.util import re import copy +from setproctitle import setproctitle # Twisted is pretty important, so I keep it separate from twisted.internet.protocol import Factory, Protocol @@ -94,6 +95,11 @@ def config_reports(_config, _factory): logger.debug('(REPORT) Periodic reporting loop started') _server.send_config() _server.send_bridge() + i = 0 + for system in CONFIG['SYSTEMS']: + if 'PEERS' in CONFIG['SYSTEMS'][system] and CONFIG['SYSTEMS'][system]['PEERS']: + i = i +1 + logger.info('(REPORT) %s systems have at least one peer',i) logger.info('(REPORT) HBlink TCP reporting server configured') @@ -2129,6 +2135,9 @@ if __name__ == '__main__': ID_MAX = 16776415 + #Set process title early + setproctitle(__file__) + # Change the current directory to the location of the application os.chdir(os.path.dirname(os.path.realpath(sys.argv[0]))) diff --git a/hotspot_proxy_v2.py b/hotspot_proxy_v2.py index 50d8f03..92f73c1 100644 --- a/hotspot_proxy_v2.py +++ b/hotspot_proxy_v2.py @@ -5,11 +5,12 @@ from dmr_utils3.utils import int_id import random import ipaddress import os +import setproctitle from proctitle # Does anybody read this stuff? There's a PEP somewhere that says I should do this. __author__ = 'Simon Adlem - G7RZU' __copyright__ = 'Copyright (c) Simon Adlem, G7RZU 2020,2021' -__credits__ = 'Jon Lee, G4TSN; Norman Williams, M6NBP' +__credits__ = 'Jon Lee, G4TSN; Norman Williams, M6NBP; Christian, OA4DOA' __license__ = 'GNU GPLv3' __maintainer__ = 'Simon Adlem G7RZU' __email__ = 'simon@gb7fr.org.uk' @@ -183,7 +184,11 @@ if __name__ == '__main__': BlackList = [1234567] #******************* - + + + #Set process title early + setproctitle(__file__) + #If IPv6 is enabled by enivornment variable... if ListenIP == '' and 'FDPROXY_IPV6' in os.environ and bool(os.environ['FDPROXY_IPV6']): ListenIP = '::' diff --git a/playback.py b/playback.py index 2fcbcd7..0551732 100755 --- a/playback.py +++ b/playback.py @@ -25,6 +25,7 @@ from bitarray import bitarray from time import time, sleep from importlib import import_module from random import randint +from setproctitle import setproctitle # Twisted is pretty important, so I keep it separate from twisted.internet.protocol import Factory, Protocol @@ -172,6 +173,9 @@ if __name__ == '__main__': import signal from dmr_utils3.utils import try_download, mk_id_dict + #Set process title early + setproctitle(__file__) + # Change the current directory to the location of the application os.chdir(os.path.dirname(os.path.realpath(sys.argv[0])))