iftest $(whoami) != root then echo"require root privilege" exit 1 fi
SWAPFILE_SIZE_GB=8 # 8GB
SWAPFILE_SIZE=$(stat --format="%s" /swapfile) EXPECT_SIZE=$(($SWAPFILE_SIZE_GB << 30)) if [[ $SWAPFILE_SIZE == $EXPECT_SIZE ]] then echo"Swapfile is no need to expand." exit 0 fi