watchdog is a daemon that periodically pokes a hardware chip, and if it fails to do so (presumaby because the system got stuck), the chip would reboot the system. A somehow working software emulation of this chip, called "softdog" also exists in Linux. A reboot can be triggered by some other criteria too. This script installs a RedHat-style initscript, but you can run it from /etc/rc.d/rc.local too. This daemon needs a proper kernel driver to work. Some machines, such as raspberry pi 4b, provide /dev/wachdog by default. Intel systems might require editing /etc/sysconfig/watchdog to have START_MOD_CMD="modprobe iTCO_wdt" and You can try "softdog" if nothing better is available.