Skip to content

Commit

Permalink
Added swapping to script
Browse files Browse the repository at this point in the history
  • Loading branch information
johc committed May 3, 2024
1 parent 119b344 commit eac867d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions server_create
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,19 @@ export OLD_PARSE_APP_ID=""
export OLD_PARSE_PORT="4000"
export OLD_SERVER_IP=""

# Check for existing swap space and add if none exists
if free | awk '/Swap:/ {exit !$2}'; then
echo "Swap exists."
else
echo "No swap space detected. Adding swap space..."
sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
# Make the swap file permanent by adding it to /etc/fstab
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
fi


# Set non-interactive frontend for automatic handling of all prompts
export DEBIAN_FRONTEND=noninteractive
Expand Down

0 comments on commit eac867d

Please sign in to comment.