From 152ad5aa866ecacb8b1bf3ddb0379e7f59a34c60 Mon Sep 17 00:00:00 2001 From: Konano Date: Mon, 27 Nov 2023 13:14:42 +0800 Subject: [PATCH] Update earlyoom config file --- files/earlyoom.conf | 22 ++++++++++++++++++++++ init_priv.sh | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/files/earlyoom.conf b/files/earlyoom.conf index e6d5104..c898431 100644 --- a/files/earlyoom.conf +++ b/files/earlyoom.conf @@ -1 +1,23 @@ +# Default settings for earlyoom. This file is sourced by /bin/sh from +# /etc/init.d/earlyoom or by systemd from earlyoom.service. + +# Options to pass to earlyoom +EARLYOOM_ARGS="-r 60" + +# Examples: + +# Print memory report every second instead of every minute +# EARLYOOM_ARGS="-r 1" + +# Available minimum memory 5% +# EARLYOOM_ARGS="-m 5" + +# Available minimum memory 15% and free minimum swap 5% +# EARLYOOM_ARGS="-m 15 -s 5" + +# Avoid killing processes whose name matches this regexp +# EARLYOOM_ARGS="--avoid '(^|/)(init|X|sshd|firefox)$'" + +# See more at `earlyoom -h' + EARLYOOM_ARGS="-m 6 -s 6" diff --git a/init_priv.sh b/init_priv.sh index f704f74..e3527e0 100755 --- a/init_priv.sh +++ b/init_priv.sh @@ -189,7 +189,7 @@ configure_user_oom_killer() { if confirm_action "要启用 earlyoom 吗?" "Y"; then sudo apt install earlyoom -y - cat $scriptdir/files/earlyoom.conf | sudo tee -a /etc/default/earlyoom >/dev/null + sudo cp $scriptdir/files/earlyoom.conf /etc/default/earlyoom sudo systemctl restart earlyoom fi }