base-stack/sbin/swap2ram.sh
Matthew Saunders Brown 3a27b9a841 initial commit
2022-11-17 09:47:11 -08:00

8 lines
236 B
Bash
Executable File

#!/bin/bash
err="not enough RAM to write swap back, nothing done"
mem=`free|grep Mem:|awk '{print $4}'`
swap=`free|grep Swap:|awk '{print $3}'`
test $mem -lt $swap && echo -e $err && exit 1
/sbin/swapoff -a && /sbin/swapon -a &&
exit 0