earlyoom now works on reboots (#6841)

This commit is contained in:
Michael Vines 2019-11-08 16:40:38 -07:00 committed by GitHub
parent 162b1bdef7
commit 151adab739
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -7,9 +7,10 @@ set -ex
[[ $(uname) = Linux ]] || exit 1
[[ $USER = root ]] || exit 1
# 64 - enable signalling of processes (term, kill, oom-kill)
# TODO: This setting will not persist across reboots
sysctl -w kernel.sysrq=$(( $(cat /proc/sys/kernel/sysrq) | 64 ))
# earlyoom specifically needs "SysRq 64 - enable signalling of processes (term, kill, oom-kill)"
# but for simplicity just enable all SysRq
sysctl -w kernel.sysrq=1
echo kernel.sysrq=1 >> /etc/sysctl.conf
if command -v earlyoom; then
systemctl status earlyoom