verbose status check script

This commit is contained in:
Data Backend account
2022-02-15 09:44:01 +01:00
parent 1ca20a423d
commit f0943e5919
+17 -1
View File
@@ -1,10 +1,26 @@
#!/bin/bash
GREP="std|streamvis"
while getopts g: flag
RESTART="OFF"
STATUS_VERBOSE="OFF"
while getopts g:s: flag
do
case "${flag}" in
g) GREP=${OPTARG};;
# r) RESTART='ON';;
s) STATUS_VERBOSE=${OPTARG};;
esac
done
if [ ${STATUS_VERBOSE} = "ON" ]; then
systemctl list-units --type service --all | grep -E ${GREP} | awk '{print $1}' | xargs -I{} systemctl status {}
fi
#if [ RESTART = "ON" ]; then
# systemctl list-units --type service --all | grep -E ${GREP} | awk '{print $1}' | xargs -I{} systemctl restart {}
#fi
systemctl list-units --type service --all | grep -E ${GREP} | awk 'BEGIN{print "Unit State Status"};$4 ~ /^running$/{print $1,$2,$4}' | column -t