monitoring-plugins/check_systemd.sh
2020-04-19 12:51:33 +02:00

16 lines
253 B
Bash
Executable file

#!/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 $retcode