Add script max-memory-lx-container.sh - shows settings for LX Container configuration for memory limit.

This commit is contained in:
Christoph 2019-04-18 11:39:41 +02:00
parent 204d008e76
commit f2291aca69

20
max-memory-lx-container.sh Executable file
View File

@ -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