initial commit
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
state=$(systemctl is-system-running 2>/dev/null || true)
|
||||
uptime_str() {
|
||||
awk '{s=int($1);d=int(s/86400);h=int((s%86400)/3600);m=int((s%3600)/60);
|
||||
if(d>0)printf "%d days %d hours",d,h;
|
||||
else if(h>0)printf "%d hours %d min",h,m;
|
||||
else printf "%d min",m}' /proc/uptime
|
||||
}
|
||||
printf 'HOST: %s UP: %s STATE: %s\n' "$(hostname)" "$(uptime_str)" "$state"
|
||||
printf '%0.s-' {1..60}; printf '\n'
|
||||
|
||||
systemctl list-units --all --type=service \
|
||||
--state=active,failed --no-legend --no-pager --plain 2>/dev/null \
|
||||
| awk '
|
||||
NF >= 4 {
|
||||
unit=$1; active=$3; sub=$4
|
||||
if (unit ~ /^(getty@|console-getty\.service)/) next
|
||||
if (unit ~ /^systemd-(tmpfiles|binfmt|modules-load|sysctl|ask-password|remount|random-seed|update-done|hibernate|sleep|suspend|reboot|poweroff)/) next
|
||||
state = (active == "failed") ? "FAILED" : sub
|
||||
printf " %-50s %s\n", unit, state
|
||||
}
|
||||
'
|
||||
Reference in New Issue
Block a user