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