Search Our Database

How to set an automatic reboot when the server is out of memory (linux)

Last updated on |

Sometimes a server may hang when it’s running out of memory (RAM). In this case, the user will be unable to ssh into the server. A manual reboot will be required.

Here is to way to automate the reboot when the server is out of memory.

1.) SSH into the server and open the sysctl.conf file as below:

vi /etc/sysctl.conf

2.) Add the following lines into the config file.

vm.panic_on_oom=1   ;enables panic on OOM
kernel.panic=10     ;tells the kernel to reboot ten seconds after panicking