tbbooher / new_cfa

new cfa site
MIT License
0 stars 0 forks source link

Reboot server on out-of-memory condition #55

Open tbbooher opened 9 years ago

tbbooher commented 9 years ago

It is good to automatically reboot your server when it runs out of memory. This will cause a minute or two of downtime, but it’s better than languishing in the swapping state for potentially hours or days.

You can leverage a couple kernel settings and Lassie to make this happen on Linode.

Adding the following two lines to your /etc/sysctl.conf will cause it to reboot after running out of memory:

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

Read more about rebooting when out of memory on Linode’s wiki.

tbbooher commented 9 years ago

http://feross.org/how-to-setup-your-linode/