From 72f43265b5b929865c3d9696964cb06c9850f799 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 --- 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 d070169..a4d9c08 100755 --- a/install.sh +++ b/install.sh @@ -189,6 +189,10 @@ sudo cp -rp templates/webpanel/* /var/www/wx/ 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 660b81c..3523af8 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