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