I am trying to get the status of systemctl service using below command.
systemctl --no-pager status service_name | grep "Active" | cut -d ":" -f2
The output i am getting is
active (exited) since Mon 2023-09-04 21
I just want active or inactive in the output. How do I achieve this ?
systemctl is-active service_name
What this command does is check whether any of the specified units are active (i.e. running). Returns an exit code 0 if at least one is active, or non-zero otherwise. You can find it int the man manual
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With