diff --git a/genswap.sh b/genswap.sh index e7161e1..4ce74d6 100755 --- a/genswap.sh +++ b/genswap.sh @@ -162,10 +162,17 @@ function setSwappinessLvl(){ 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(){ 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 "-s | --swappiness Set the swappiness value to minimize swap usage\n\n" + echo -e "-a | --auto Automatically create and size swapfile based on physical memory\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(){ @@ -198,10 +205,14 @@ case "${1}" in version ;; - -s|--swappiness) + -ss|--set-swappiness) setSwappinessLvl ;; + -ls|--live-swappiness) + liveSwappiness + ;; + *) help ;;