Sometimes on a Linux server, particularly if there isn't enough memory allocated on a server or the tasks being queued cannot be done with the available resources over a period of time, tasks may hang on the server. This can be fatal and cause the server to become unresponsive.
To setup the server so it restarts if this occurs automatically you need:
Login to SSH
To make these settings live without rebooting type:
sysctl kernel.panic=5
sysctl kernel.hung_task_panic=1
sysctl vm.panic_on_oom=1
Edit the configuration file so the changes will also occur after a reboot type:
pico /etc/sysctl.conf
Add the following to the bottom of the file
# Reboot 5 seconds after panic kernel.panic = 5 # Panic if a hung task was found kernel.hung_task_panic = 1
# Panic if OOM-Killer is initiated vm.panic_on_oom = 1
To save Press: CTRL O
To exit Press: CTRL X