17 lines
300 B
Plaintext
17 lines
300 B
Plaintext
|
#!/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
|