Wait in Bash Script Until Enough Memory is Free

Sometimes you need to wait until some amount of memory becomes free / available to proceed in a bash script.
For such cases MemAvailable in /proc/meminfo can be parsed. The following function checks this against some passed value and also allows to specify a timeout:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.