> Adding **swap** to the repo
This commit is contained in:
2023-12-12 23:39:20 -08:00
parent fff595685f
commit 715940f9e8
3 changed files with 127 additions and 0 deletions

19
swap/swap.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/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