From 0733c045fcda781d91cc8eeb5c0f828d318be5c1 Mon Sep 17 00:00:00 2001 From: Nico Rey Date: Sun, 4 Oct 2020 13:13:21 -0300 Subject: [PATCH] disable ramfs for meteor passes on <2Gi ram systems (cherry picked from commit 72f43265b5b929865c3d9696964cb06c9850f799) Signed-off-by: Nico Rey --- install.sh | 4 ++++ receive_meteor.sh | 7 +++++++ templates/fstab | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 742f6f1..5bbf2c0 100755 --- a/install.sh +++ b/install.sh @@ -182,6 +182,10 @@ fi log_done "Nginx configured" ### Setup ramFS +SYSTEM_MEMORY=$(free -m | awk '/^Mem:/{print $2}') +if [ "$SYSTEM_MEMORY" -lt 2000 ]; then + sed -i -e "s/1000M/200M/g" templates/fstab +fi set +e cat /etc/fstab | grep -q "ramfs" if [ $? -eq 0 ]; then diff --git a/receive_meteor.sh b/receive_meteor.sh index 3c1e29c..f9edefc 100755 --- a/receive_meteor.sh +++ b/receive_meteor.sh @@ -5,6 +5,13 @@ . "$HOME/.tweepy.conf" . "$NOAA_HOME/common.sh" + +SYSTEM_MEMORY=$(free -m | awk '/^Mem:/{print $2}') +if [ "$SYSTEM_MEMORY" -lt 2000 ]; then + log "The system doesn't have enough space to store a Meteor pass on RAM" "INFO" + RAMFS_AUDIO="${METEOR_OUTPUT}" +fi + ## pass start timestamp and sun elevation PASS_START=$(expr "$5" + 90) SUN_ELEV=$(python3 "$NOAA_HOME"/sun.py "$PASS_START") diff --git a/templates/fstab b/templates/fstab index 023fb81..d76b2c0 100644 --- a/templates/fstab +++ b/templates/fstab @@ -1 +1 @@ -tmpfs /var/ramfs tmpfs nodev,nosuid,size=400M 0 0 +tmpfs /var/ramfs tmpfs nodev,nosuid,size=1000M 0 0