Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated systemctl command + regex #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AndrewMRQuinn
Copy link

@AndrewMRQuinn AndrewMRQuinn commented Oct 2, 2023

Thanks for the script!
I found a couple of issues when testing and wanted to share the tweaks we made.

On some distros the "systemctl list-units" output contains an additional column to the left that can contain bullet points. This results in space and/or bullet characters being encoded as part of the OID. Adding "--plain" to the systemctl command prevents these bullets from being printed and interpreted as part of the service name.

Without "--plain" on Ubuntu 22.04
image

With "--plain" on Ubuntu 22.04
image

We also found that the sub-state for some services could be "auto-restart", which failed to match the existing regex because of the dash character. I've tweaked it to accept a dash.

We've tested the changes on AlmaLinux 8.8, CentOS 7, Debian 12, Kali Linux, Rocky Linux 9.2, openSUSE Leap 15.5, Ubuntu 18.04, and Ubuntu 22.04.

Added "--plain" to systemctl command to omit bullets, and updated  regex to allow dashes in sub-state
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant