Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

12 changes: 0 additions & 12 deletions .gitignore

This file was deleted.

26 changes: 5 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ Disclamer: This script may not work on every GNU/Linux distro. Sorry.

## Usage

First of all, download the main script:
First of all, download the main script using `wget` or `curl`:
```
wget https://raw.githubusercontent.com/Cretezy/Swap/master/swap.sh -O swap
# or using curl:
# curl https://raw.githubusercontent.com/Cretezy/Swap/master/swap.sh -o swap
```

Then simply run the file with this format:
```
sh swap {size}
sh swap <size>
```

Example (with 4G):
Expand All @@ -25,23 +27,5 @@ 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
sh swap 4G /swap
```

## Ansible

Ansible Playbook collection to make things easier and faster

### Run Playbook

`ansible-playbook -i '0.0.0.0' ansible-swap/server.yml`

With the server's IP.


### Changes to be made as required

`ansible-swap/tasks/main.yml`

1. Change location - location on your server/instance
2. Change Memory to be allocated
6 changes: 0 additions & 6 deletions ansible-swap/server.yml

This file was deleted.

5 changes: 0 additions & 5 deletions ansible-swap/tasks/main.yml

This file was deleted.

4 changes: 2 additions & 2 deletions swap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ fi

## Run
sudo fallocate -l $SWAP_SIZE $SWAP_PATH # Allocate size
sudo chmod 600 $SWAP_PATH # Make it non-world readable (bad!)
sudo mkswap $SWAP_PATH # Setup swap"
sudo chmod 600 $SWAP_PATH # Set proper permission
sudo mkswap $SWAP_PATH # Setup swap
sudo swapon $SWAP_PATH # Enable swap
echo "$SWAP_PATH none swap sw 0 0" | sudo tee /etc/fstab -a # Add to fstab

Expand Down