From 89ae8632e0d9933ce934e4aa73233c57be6ec8e1 Mon Sep 17 00:00:00 2001 From: Ilia Ross Date: Wed, 15 Jan 2025 01:23:03 +0200 Subject: [PATCH] Add `is_active_systemd` sub --- init/init-lib.pl | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/init/init-lib.pl b/init/init-lib.pl index cf8804b99..29aae067e 100644 --- a/init/init-lib.pl +++ b/init/init-lib.pl @@ -2533,6 +2533,23 @@ else { } } +=head2 is_active_systemd() + +Check if systemd service or socket is active + +=cut +sub is_active_systemd +{ +my $unit = shift; +if ($init_mode eq "systemd") { + my $out = &backquote_logged( + "systemctl is-active ".quotemeta($unit)." 2>&1