#!/bin/sh -eu
# shellcheck disable=SC1091
[ -e /lxc-ci/etc/config ] && . /lxc-ci/etc/config

if [ "${DAILY_REBOOT:-}" != "true" ]; then
    exit 0
fi

dmesg | grep -q "Out of memory" && reboot
dmesg | grep -q "BTRFS.*forced readonly" && reboot
dmesg | grep -q "kernel BUG at" && reboot
dmesg | grep -q "WARNING: CPU:.*queue_work" && reboot
dmesg | grep -q "blocked for more than 120 seconds" && reboot
dmesg | grep -q "ceph.*tid.*pool does not exist" && reboot

exit 0
