#!/bin/bash
#script from ubuntuforums
echo “Ubuntu Linux Readyboost Feature”
echo "-------------------------------"
RB_ON()
{
clear
echo "Turning Readyboost ON"
sudo umount /dev/$device
echo "----------------------"
sudo fdisk -l
echo "----------------------"
read -p "Enter the device name (eg. \"sda1\") : " device
sudo mkswap /dev/$device
sudo swapon -p 32767 /dev/$device
echo "---------------------------------------------------------------"
echo "Please confirm that system has turned on Readyboost (/dev/$device)"
cat /proc/swaps
}
RB_OFF()
{
clear
echo "Turning Readyboost OFF"
echo "----------------------"
sudo fdisk -l
echo "----------------------"
read -p "Enter the device name (eg. \"sda1\") : " device
sudo swapoff /dev/$device
echo "---------------------------------------------------------------"
echo "Please confirm that system has turned on Readyboost (/dev/$device)"
cat /proc/swaps
}
input()
{
echo "1. Turn ON Readyboost"
echo "2. Turn OFF Readyboost"
echo "3. Quit"
read -p "Action: " answer
}
input
case $answer in
1)
RB_ON;;
2)
RB_OFF;;
3)
exit;;
*)
echo "Invalid Input"
echo "-------------------------"
input
esac