LXC/max-memory-lx-container.sh

21 lines
575 B
Bash
Executable File

#!/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