From 7cbbc3633b17c530aaa5b0900e3d0f846c867e6d Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Tue, 17 Mar 2026 16:53:35 -0700 Subject: [PATCH] action_utils: Stop associated service when stopping a socket unit Tests: - Unit tests pass. - Radicale and Bepasty functional tests pass with changes to migrate to new systemd socket-activated units. Signed-off-by: Sunil Mohan Adapa --- plinth/action_utils.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plinth/action_utils.py b/plinth/action_utils.py index 168e390b0..f01aef15c 100644 --- a/plinth/action_utils.py +++ b/plinth/action_utils.py @@ -123,6 +123,14 @@ def service_disable(service_name: str, check: bool = False): except subprocess.CalledProcessError: pass + if service_name.endswith('.socket'): + # Instead, may need to query the unit for associated .service file. + base_name = service_name.rpartition('.')[0] + try: + service_stop(f'{base_name}.service', check=check) + except subprocess.CalledProcessError: + pass + def service_mask(service_name: str, check: bool = False): """Mask a service"""