From 6f302fc8df7d9fb668838362f218b9715d6f0c04 Mon Sep 17 00:00:00 2001 From: Daniel Ehlers Date: Mon, 17 Feb 2014 23:23:29 +0100 Subject: [PATCH] gluon-core: force kernel panic on out of memory In combination with kernel.panic the node will reboot if out of memory. --- package/gluon-core/files/lib/gluon/functions/sysctl.sh | 4 ++++ .../files/lib/gluon/upgrade/core/invariant/012-reboot-on-oom | 5 +++++ 2 files changed, 9 insertions(+) create mode 100644 package/gluon-core/files/lib/gluon/functions/sysctl.sh create mode 100755 package/gluon-core/files/lib/gluon/upgrade/core/invariant/012-reboot-on-oom diff --git a/package/gluon-core/files/lib/gluon/functions/sysctl.sh b/package/gluon-core/files/lib/gluon/functions/sysctl.sh new file mode 100644 index 00000000..df1ea217 --- /dev/null +++ b/package/gluon-core/files/lib/gluon/functions/sysctl.sh @@ -0,0 +1,4 @@ +sysctl_set() { + sed -i "/^${1//./\.}=/d" /etc/sysctl.conf + echo "${1}=$2" >> /etc/sysctl.conf +} diff --git a/package/gluon-core/files/lib/gluon/upgrade/core/invariant/012-reboot-on-oom b/package/gluon-core/files/lib/gluon/upgrade/core/invariant/012-reboot-on-oom new file mode 100755 index 00000000..a457a9c3 --- /dev/null +++ b/package/gluon-core/files/lib/gluon/upgrade/core/invariant/012-reboot-on-oom @@ -0,0 +1,5 @@ +#!/bin/sh + +. /lib/gluon/functions/sysctl.sh + +sysctl_set vm.panic_on_oom 1