escripts/swap/swap.sh
Eugene Amos 715940f9e8 Swap
> Adding **swap** to the repo
2023-12-12 23:39:20 -08:00

20 lines
396 B
Bash
Executable File

#!/bin/bash
# Turn off swap
echo "Executing swapoff..."
sudo /sbin/swapoff -a
# Wait until swap is fully off
while [ $(free | grep Swap | awk '{print $3}') -gt 0 ]; do
echo "Waiting for swapoff to complete..."
sleep 5
done
# Wait an additional 30 seconds
echo "Swapoff completed. Waiting for 30 seconds..."
sleep 30
# Turn swap back on
echo "Executing swapon..."
sudo /sbin/swapon -a