From f2291aca69562eaa5137b2384d8174868d1d3224 Mon Sep 17 00:00:00 2001 From: Christoph Date: Thu, 18 Apr 2019 11:39:41 +0200 Subject: [PATCH] Add script max-memory-lx-container.sh - shows settings for LX Container configuration for memory limit. --- max-memory-lx-container.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 max-memory-lx-container.sh diff --git a/max-memory-lx-container.sh b/max-memory-lx-container.sh new file mode 100755 index 0000000..0955bbd --- /dev/null +++ b/max-memory-lx-container.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +echo "" +echo -e " \033[32mTotal Memory:\033[23G\033[m$(free -b | grep -oP '\d+' | head -n 1) Byte" +echo "" +echo -e " \033[33mMax Memory LXC:\033[23G\033[m\033[1m$(( $(free -b | grep -oP '\d+' | head -n 1)-1000000000 ))\033[m Byte" +echo "" + +echo -e " + In order to set max memory to your LX Container add the following + line(s) to yor conatiner configuration: +\033[1m +# Limt memory to 1GB less than full Memory of the machine +# - +lxc.cgroup.memory.limit_in_bytes = $(( $(free -b | grep -oP '\d+' | head -n 1)-1000000000 )) +\033[m +" + +echo "" +exit 0