Simple swap setup script for Linux
Swap is an area on a hard drive that has been designated as a place where the operating system can temporarily store data that it can no longer hold in RAM.
Disclamer: This script may not work on every GNU/Linux distro. Sorry.
First of all, download the main script:
wget https://raw.githubusercontent.com/Cretezy/Swap/master/swap.sh -O swap
Then simply run the file with this format:
sh swap {size}
Example (with 4G):
sh swap 4G
The default path for the swap file is /swapfile. If you wish to change this, simple the file location (file must not exist) add it to the command:
sh swap 4G /mynewswapfile
Ansible Playbook collection to make things easier and faster
ansible-playbook -i '0.0.0.0' ansible-swap/server.yml
With the server's IP.
ansible-swap/tasks/main.yml
- Change location - location on your server/instance
- Change Memory to be allocated