PowerShell/Scripts/swap2ram
Markus Fleschutz fed6df1977 Added swap2ram
2020-07-16 15:39:24 +00:00

13 lines
253 B
Bash
Executable File

#!/bin/sh
mem=$(LC_ALL=C free | awk '/Mem:/ {print $4}')
swap=$(LC_ALL=C free | awk '/Swap:/ {print $3}')
if [ $mem -lt $swap ]; then
echo "ERROR: not enough RAM to write swap back, nothing done" >&2
exit 1
fi
swapoff -a && swapon -a
exit 0