Swap
> Adding **swap** to the repo
This commit is contained in:
19
swap/swap.sh
Executable file
19
swap/swap.sh
Executable 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
|
||||
Reference in New Issue
Block a user