genswap.sh: add option to view current swappiness level
Former-commit-id: ff1ae6603e86d69d72073934dd646e0aead602e2 Former-commit-id: 176536b5c4673c2c219494a6f43e44a9204053e7
This commit is contained in:
parent
7a0c927d2d
commit
fa1496dccd
15
genswap.sh
15
genswap.sh
@ -162,10 +162,17 @@ function setSwappinessLvl(){
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
liveSwappiness(){
|
||||||
|
CURRENTSWAPPINESS=$(cat /proc/sys/vm/swappiness)
|
||||||
|
echo -e "\n${LCYAN}Current swappiness value: (reboot to apply any changes you set):${NC}\n"
|
||||||
|
echo -e "${LGREEN}${CURRENTSWAPPINESS}${NC}\n"
|
||||||
|
}
|
||||||
|
|
||||||
function help(){
|
function help(){
|
||||||
echo -e "\nUsage: $0 [-a] [--auto] [-s] [--swappiness]\n\n"
|
echo -e "\nUsage: $0 [-a] [--auto] [-s] [--swappiness]\n\n"
|
||||||
echo -e "-a | --auto Automatically create and size swapfile based on physical memory\n"
|
echo -e "-a | --auto Automatically create and size swapfile based on physical memory\n"
|
||||||
echo -e "-s | --swappiness Set the swappiness value to minimize swap usage\n\n"
|
echo -e "-ss | --set-swappiness Set the swappiness value to minimize swap usage\n\n"
|
||||||
|
echo -e "-ls | --live-swappiness View current swappiness level"
|
||||||
}
|
}
|
||||||
|
|
||||||
function version(){
|
function version(){
|
||||||
@ -198,10 +205,14 @@ case "${1}" in
|
|||||||
version
|
version
|
||||||
;;
|
;;
|
||||||
|
|
||||||
-s|--swappiness)
|
-ss|--set-swappiness)
|
||||||
setSwappinessLvl
|
setSwappinessLvl
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
-ls|--live-swappiness)
|
||||||
|
liveSwappiness
|
||||||
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
help
|
help
|
||||||
;;
|
;;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user