PowerShell/Scripts/swap2ram

14 lines
352 B
Plaintext
Raw Normal View History

2020-07-16 17:39:24 +02:00
#!/bin/sh
2020-10-16 16:37:24 +02:00
#
# NOTE: for automation copy me to /etc/cron.daily
2020-07-16 17:39:24 +02:00
2020-10-09 19:13:14 +02:00
RAMsize=$(LC_ALL=C free | awk '/Mem:/ {print $2}')
RAMfree=$(LC_ALL=C free | awk '/Mem:/ {print $4}')
SwapUsed=$(LC_ALL=C free | awk '/Swap:/ {print $3}')
2020-07-16 17:39:24 +02:00
2020-10-09 19:13:14 +02:00
echo "Swapping $SwapUsed bytes back to $RAMsize bytes RAM ($RAMfree bytes free) ..."
2020-07-16 17:39:24 +02:00
swapoff -a && swapon -a
2020-10-09 19:13:14 +02:00
echo "Done."
2020-07-16 17:39:24 +02:00
exit 0