Added swap2ram

This commit is contained in:
Markus Fleschutz 2020-07-16 15:39:24 +00:00
parent 08295b989b
commit fed6df1977

12
Scripts/swap2ram Executable file
View File

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