Automatically Create/Remove And Mount Swap File In Linux Using Shell Script
Create Swap File
Add execute permission to the file.
$ sudo +x create_swap.sh
Run the file to create and mount swap file.
$ sudo ./create_swap.sh
Remove Swap File
Add execute permission to the file.
$ sudo +x remove_swap.sh
Run the file to remve and unmount swap file.
$ sudo ./remove_swap.sh