Remove swap2ram.sh

This commit is contained in:
Markus Fleschutz 2023-08-05 15:21:38 +02:00
parent ee4091adab
commit e68bca293a

View File

@ -1,26 +0,0 @@
#!/bin/sh
# Syntax: ./swap2ram
# Description: swaps back to RAM
# Author: Markus Fleschutz
# Source: github.com/fleschutz/PowerShell
# License: CC0
# NOTE: for automation copy this script to /etc/cron.daily
if ! [ $(id -u) = 0 ]; then
echo "Please run this script as root"
exit 1
fi
SwapUsed=$(LC_ALL=C free --human --si | awk '/Swap:/ {print $3}')
RAMsize=$(LC_ALL=C free --human --si | awk '/Mem:/ {print $2}')
RAMused=$(LC_ALL=C free --human --si | awk '/Mem:/ {print $3}')
RAMfree=$(LC_ALL=C free --human --si | awk '/Mem:/ {print $4}')
printf "Swapping $SwapUsed back to RAM ($RAMsize total, $RAMused used, $RAMfree free) ... "
start=`date +%s`
swapoff -a && swapon -a
end=`date +%s`
echo "DONE (`expr $end - $start` sec.)"
exit 0