systemd check

This commit is contained in:
Matěj Divecký 2020-04-19 12:15:40 +02:00
parent 704546b018
commit 3107d58370

16
check_systemd.sh Executable file
View file

@ -0,0 +1,16 @@
#!/bin/bash
retcode=0
for i in "$@"; do
active=$(systemctl is-active "$i")
if [ "$?" -ne 0 ]; then
echo -n "$i is $active; "
retcode=2
fi
done
if [ "$retcode" -eq 0 ]; then
echo -n "all services are active"
fi
echo
exit