diff options
| author | Mitch Riedstra <mitch@riedstra.us> | 2019-10-15 20:56:41 -0400 |
|---|---|---|
| committer | Mitch Riedstra <mitch@riedstra.us> | 2019-10-15 20:56:41 -0400 |
| commit | eefbd029b55b2782b0d7b11b4989ce0ca9b256cd (patch) | |
| tree | 535511fd3154342117d67171e28a312bd30c7f87 /util/zram.sh | |
| parent | 5840f413825e053b645a338d71c1916a06094335 (diff) | |
| download | dotfiles-eefbd029b55b2782b0d7b11b4989ce0ca9b256cd.tar.gz dotfiles-eefbd029b55b2782b0d7b11b4989ce0ca9b256cd.tar.xz | |
Massive organization of my dotfiles
Diffstat (limited to 'util/zram.sh')
| -rwxr-xr-x | util/zram.sh | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/util/zram.sh b/util/zram.sh new file mode 100755 index 0000000..bacfb1f --- /dev/null +++ b/util/zram.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +if [ $(id -u) -ne 0 ] ; then + echo "Please run as root" + exit 1; +fi + + +start() { + modprobe zram + echo lz4 > /sys/block/zram0/comp_algorithm + echo 2G > /sys/block/zram0/disksize + + mkswap --label zram0 /dev/zram0 + swapon --priority 100 /dev/zram0 + + sysctl vm.swappiness=100 +} + +stop() { + swapoff /dev/zram0 + modprobe -r zram + + sysctl vm.swappiness=60 +} + +$1 |
