I think free_disk
will contain KB and hence it will check if there are 5MB of storage space available, instead if 5GB, so it should be -lt 5000000
.
free_disk="$(df /var | tail -n 1 | awk '{print $4}')"
if [ "$free_disk" -lt 5000 ]; then
I’ve checked this on Ubuntu 18.04 and 20.04.