If swap file exists, do nothing

this gives users more control on how to allocate swap
This commit is contained in:
Girish Ramakrishnan
2020-08-18 12:56:49 -07:00
parent 252aedda25
commit 242548b36a
2 changed files with 7 additions and 0 deletions

View File

@@ -4,6 +4,11 @@ set -eu -o pipefail
readonly APPS_SWAP_FILE="/apps.swap"
if [[ -f "${APPS_SWAP_FILE}" ]]; then
echo "Swap file already exists at /apps.swap . Skipping"
exit
fi
# all sizes are in mb
readonly physical_memory=$(LC_ALL=C free -m | awk '/Mem:/ { print $2 }')
readonly swap_size=$((${physical_memory} > 4096 ? 4096 : ${physical_memory})) # min(RAM, 4GB) if you change this, fix enoughResourcesAvailable() in client.js