computer-playbook/roles/native-journalctl-health-check/files/journalctl-health-check.sh

10 lines
296 B
Bash
Raw Normal View History

2023-04-15 14:31:18 +02:00
#!/bin/sh
echo "Checking journalctl for error messages..."
journalctl_errors="$(journalctl --since '1 day ago' --no-pager | grep -i 'error')"
if [ ! -z "$journalctl_errors" ]
then
echo "Some errors where found: $journalctl_errors"
exit 1
fi
echo "All docker containers are healthy."
exit 0