systemd
This commit is contained in:
parent
429f9e1dc5
commit
a0569441d3
24
modules/services.sh
Normal file
24
modules/services.sh
Normal file
@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
|
||||
name='Services'
|
||||
recommend=0
|
||||
if command -v systemctl >/dev/null 2>&1; then
|
||||
available=1
|
||||
else
|
||||
available=0
|
||||
fi
|
||||
|
||||
check() {
|
||||
systemctl list-units --type=service --plain --no-legend --no-pager | while IFS= read -r line; do
|
||||
service=$(printf '%s\n' "$line" | awk '{print $1}')
|
||||
state=$(printf '%s\n' "$line" | awk '{print $4}')
|
||||
|
||||
[ -n "$service" ] || continue
|
||||
|
||||
if [ "$state" = "failed" ]; then
|
||||
warn "$service" "" "Service $service failed"
|
||||
else
|
||||
ok "$service" "" "Service $service is $state"
|
||||
fi
|
||||
done
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user