From d720828ff89f68e3331c90586e9d4499c627aeba Mon Sep 17 00:00:00 2001 From: Stefan Pejcic Date: Mon, 3 Jun 2024 19:33:07 +0200 Subject: [PATCH] Update INSTALL.sh --- INSTALL.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/INSTALL.sh b/INSTALL.sh index d2a9cfe4..e9a866bd 100644 --- a/INSTALL.sh +++ b/INSTALL.sh @@ -1258,6 +1258,20 @@ rm_helpers(){ } + +setup_swap(){ + # if ram less than 8GB, create swap + memory=$(grep 'MemTotal' /proc/meminfo |tr ' ' '\n' |grep [0-9]) + if [ -z "$(swapon -s)" ] && [ $memory -lt 8140752 ]; then + fallocate -l 1G /swapfile + chmod 600 /swapfile + mkswap /swapfile + swapon /swapfile + echo "/swapfile none swap sw 0 0" >> /etc/fstab + fi +} + + support_message() { echo "" echo "🎉 Welcome aboard and thank you for choosing OpenPanel! 🎉" @@ -1347,6 +1361,8 @@ main send_install_log +setup_swap + rm_helpers print_space_and_line