diff --git a/home.admin/60finishHDD.sh b/home.admin/60finishHDD.sh index e42e5a4f..5b5e5f66 100755 --- a/home.admin/60finishHDD.sh +++ b/home.admin/60finishHDD.sh @@ -35,6 +35,14 @@ if [ ${mountOK} -eq 1 ]; then sudo chown -R bitcoin:bitcoin /home/bitcoin/.lnd echo "OK - ${network} setup ready" + ###### OPTIMIZE IF RAM >1GB + kbSizeRAM=$(cat /proc/meminfo | grep "MemTotal" | sed 's/[^0-9]*//g') + if [ ${kbSizeRAM} -gt 1500000 ]; then + echo "Detected RAM >1GB --> optimizing ${network}.conf" + sudo sed -i "s/^dbcache=.*/dbcache=600/g" /mnt/hdd/${network}/${network}.conf + sudo sed -i "s/^maxmempool=.*/maxmempool=300/g" /mnt/hdd/${network}/${network}.conf + fi + ###### ACTIVATE TOR IF SET DURING SETUP if [ "${runBehindTor}" = "on" ]; then echo "TOR was selected ..." diff --git a/home.admin/_bootstrap.provision.sh b/home.admin/_bootstrap.provision.sh index 4a07ccf3..86d1077b 100644 --- a/home.admin/_bootstrap.provision.sh +++ b/home.admin/_bootstrap.provision.sh @@ -57,6 +57,14 @@ fi sudo rm -rf /etc/ssh >> ${logFile} 2>&1 sudo ln -s /mnt/hdd/ssh /etc/ssh >> ${logFile} 2>&1 +# optimze if RAM >1GB +kbSizeRAM=$(cat /proc/meminfo | grep "MemTotal" | sed 's/[^0-9]*//g') +if [ ${kbSizeRAM} -gt 1500000 ]; then + echo "Detected RAM >1GB --> optimizing ${network}.conf" + sudo sed -i "s/^dbcache=.*/dbcache=600/g" /mnt/hdd/${network}/${network}.conf + sudo sed -i "s/^maxmempool=.*/maxmempool=300/g" /mnt/hdd/${network}/${network}.conf +fi + # link and copy HDD content into new OS echo "Link HDD content for user bitcoin" >> ${logFile} sudo chown -R bitcoin:bitcoin /mnt/hdd/lnd >> ${logFile} 2>&1