LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File zramswapoff of Package systemd-zram-service (Project home:so_it_team)

#!/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