monitoring-plugins/check_systemd.sh

17 lines
253 B
Bash
Raw Permalink Normal View History

2020-04-19 12:15:40 +02:00
#!/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
2020-04-19 12:51:33 +02:00
exit $retcode