From d3d15ea51636892efb81f517d0393a7e17715039 Mon Sep 17 00:00:00 2001 From: Sven Roederer Date: Tue, 13 Oct 2020 02:58:59 +0200 Subject: [PATCH] embedded_files: freeup ram before upgrade freeup as much ram as possible before upgrade to cause less bricks on 32Mb RAM devices. Initial idea for https://github.com/freifunk-berlin/firmware/issues/806 --- .../lib/update/freifunk-berlin_freeup-ram.sh | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 embedded-files/lib/update/freifunk-berlin_freeup-ram.sh diff --git a/embedded-files/lib/update/freifunk-berlin_freeup-ram.sh b/embedded-files/lib/update/freifunk-berlin_freeup-ram.sh new file mode 100644 index 0000000000..3776eb4157 --- /dev/null +++ b/embedded-files/lib/update/freifunk-berlin_freeup-ram.sh @@ -0,0 +1,24 @@ +echo "This is the Freifunk Berlin-script" + +MEMLIMIT=33554432 # 32MB +SERVICES="cron pingcheck uhttpd rpcd odhcpd" + +MEMFREE=$(cat /proc/meminfo |grep MemTotal|awk '{print $2}') + +ifdown ffuplink + +echo stopping non-essential services +for service in $SERVICES; do + echo -n "${service} " + [ -x /etc/init.d/${service} ] && /etc/init.d/${service} running && { /etc/init.d/${service} stop; echo -n " ..stopped.. "; } +done +echo "" + +echo flushing files from /tmp +rm >/dev/null -f /tmp/luci-indexcache* +rm >/dev/null -rf /tmp/luci-modulecache + + +echo end of Freifunk Berlin-script +#exit 10 +