From 3d70f56ae72cdf3d98b8a2810351f9c9320e2e25 Mon Sep 17 00:00:00 2001 From: Derek Straka Date: Wed, 30 Nov 2016 11:13:18 -0500 Subject: [PATCH] setup-env: only allow slaves with large amounts of RAM to mount tmpfs Signed-off-by: Derek Straka --- scripts/cleanup-env.sh | 5 ++++- scripts/setup-env.sh | 7 ++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/cleanup-env.sh b/scripts/cleanup-env.sh index 1367724..9e5ef8b 100755 --- a/scripts/cleanup-env.sh +++ b/scripts/cleanup-env.sh @@ -1,5 +1,8 @@ #!/bin/bash -e -sudo umount build +# Only attempt to unmount if the directory is already mounted +if mountpoint -q `pwd`/build; then + sudo umount build +fi exit 0 diff --git a/scripts/setup-env.sh b/scripts/setup-env.sh index e5fc3b1..dbed061 100755 --- a/scripts/setup-env.sh +++ b/scripts/setup-env.sh @@ -2,6 +2,11 @@ mkdir -p build -sudo mount -t tmpfs -o size=64G,mode=755,uid=${UID} tmpfs build +total_mem=`grep MemTotal /proc/meminfo | awk '{print $2}'` + +# Only have the slaves with large amounts of RAM mount the tmpfs +if [ "$total_mem" -ge "67108864" ]; then + sudo mount -t tmpfs -o size=64G,mode=755,uid=${UID} tmpfs build +fi exit 0