1
0
Fork 1

Update README.md

This commit is contained in:
colin 2024-09-13 16:43:56 -04:00
parent 69140e1644
commit 34f3e59243
1 changed files with 14 additions and 7 deletions

View File

@ -1,5 +1,3 @@
Here's the adjusted README format for your `swap.sh` script:
# Swap File Creation Script # Swap File Creation Script
This script automatically creates a swap file on your system, allowing you to increase the available virtual memory. It calculates the optimal swap file size based on the available disk space, ensuring that the swap file does not exceed 30GB or 5% of the free disk space, whichever is smaller. This script automatically creates a swap file on your system, allowing you to increase the available virtual memory. It calculates the optimal swap file size based on the available disk space, ensuring that the swap file does not exceed 30GB or 5% of the free disk space, whichever is smaller.
@ -9,12 +7,12 @@ This script automatically creates a swap file on your system, allowing you to in
- Detects the main disk partition used by the system. - Detects the main disk partition used by the system.
- Calculates the optimal swap file size (up to 30GB or 5% of the free space). - Calculates the optimal swap file size (up to 30GB or 5% of the free space).
- Creates and activates a swap file at `/swapfile`. - Creates and activates a swap file at `/swapfile`.
- Optionally persists the swap file across reboots by adding it to `/etc/fstab`. - Optionally persists the swap file across reboots using the `--persist` flag.
- Displays the status of the created swap file. - Displays the status of the created swap file.
## Usage ## Usage
To use this script, you can execute it directly from the URL without downloading it, which is convenient for quick setup. To use this script, you can execute it directly from the URL without downloading it.
### Execute Directly from URL ### Execute Directly from URL
@ -24,16 +22,25 @@ Run the script directly from the URL using `curl` and piping to `bash`:
curl -sSL https://git.nixc.us/colin/swap-increase/raw/branch/main/swap.sh | bash curl -sSL https://git.nixc.us/colin/swap-increase/raw/branch/main/swap.sh | bash
``` ```
### Persist the Swap File Across Reboots
To ensure the swap file is persisted across reboots, run the script with the `--persist` flag:
```bash
curl -sSL https://git.nixc.us/colin/swap-increase/raw/branch/main/swap.sh | bash -s -- --persist
```
This will automatically add the swap file to `/etc/fstab`, so it is activated after a system reboot.
## Output ## Output
The script will provide the following output: The script will provide the following output:
- The calculated size of the swap file. - The calculated size of the swap file.
- Confirmation of swap file creation and activation. - Confirmation of swap file creation and activation.
- A prompt asking whether you want the swap file to persist after reboot. - Whether the swap file will persist after reboot (based on the `--persist` flag).
- Information on the current swap status using `swapon --show`. - Information on the current swap status using `swapon --show`.
## Note ## Note
This script requires `sudo` privileges to create and activate the swap file, as well as to modify the `/etc/fstab` file for persistence across reboots. This script requires `sudo` privileges to create and activate the swap file, as well as to modify the `/etc/fstab` file for persistence across reboots when using the `--persist` flag.