Subject: bug#864: systemctl list-units cannot be called

From: [email-masked]
Date: Sun, 24 Nov 2024 11:03:01 +0100

Package: systemctl-service-shim
Version: 0.0.5-1

Hello Maintainer,

please extend the script systemctl so that "systemctl list-units" can 
also be called, for example like this:

#######################
#!/bin/bash

list-units() {
     local pattern="${1:-.*}"

     for service in /etc/init.d/*; do
         service_name=$(basename "$service")

         if [[ "$service_name" =~ $pattern ]]; then
             if "$service" status 2>/dev/null | grep -q -E 
"running|active"; then
                 echo "$service_name"
             fi
         fi
     done
}

list-units "$1"
#######################

Can be called with, or without regular expression as an argument.

Many thanks
Klaus

---

From: [email-masked]
Date: Sun, 22 Dec 2024 13:21:08 +0100

I have now found that there is already a package “systemctl” in the 
Debian repository which provides extensive functionality for most 
sytemctl commands.