Skip to content

Instantly share code, notes, and snippets.

@To1ne
Created April 20, 2012 11:17
Show Gist options
  • Save To1ne/2427847 to your computer and use it in GitHub Desktop.
Save To1ne/2427847 to your computer and use it in GitHub Desktop.
#!/bin/sh
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
swapoff -a && swapon -a &&
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment