awslabs / amazon-ebs-autoscale

Don't run out of disk space on your EC2 instance when generating or working with large files. Automatically add EBS volumes to a filesystem mount point in response to disk utilization.
MIT License
113 stars 60 forks source link

trailing "/" in mountpoint option is not handled properly #49

Open ghost opened 2 years ago

ghost commented 2 years ago

If --mountpoint is specified by the user with a trailing slash (i.e. /scratch/ instead of /scratch), then the following command in bin/ebs-autoscale:

curr_size=$(df -BG ${MOUNTPOINT} | grep ${MOUNTPOINT} | awk '{print $2} ' | cut -d'G' -f1)

fails because grep does not find the ${MOUNTPOINT} string. I suggest trailing "/"s should be automatically trimmed from --mountpoint. Thanks!