systemd-zram-service/zramswapoff
2018-12-06 12:57:53 +00:00

17 lines
300 B
Bash

#!/bin/bash
# get the number of CPUs
num_cpus=$(grep -c processor /proc/cpuinfo)
# set decremented number of CPUs
decr_num_cpus=$((num_cpus - 1))
# Switching off swap
for i in $(seq 0 $decr_num_cpus); do
if [ "$(grep /dev/zram$i /proc/swaps)" != "" ]; then
swapoff /dev/zram$i
fi
done
rmmod zram