Buffer and Cache memory contain metadata and actual contents from the disk so that the operations could be done quickly.Free memory is basically unused wasted memory.Do not be worried if free memory is close to 0. Linux tries to use unused RAM for disk caching to fasten up the operations.We will use bc to handle Floating-point arithmetic operations in bash. We will use the free -m command coupled with awk to filter our unnecessary details so as to view the free memory, available memory, buffer, and cached memory and finally calculate Memory used percentage. #Total memory usage is Total Memory - Available MemoryĮcho "System is critically low on memory!"Įcho -e "\nMEMORY OK\n." TOTAL_USED_MEM=$(( $TOTAL_MEM - $AVAILABLE_MEM )) Step 3: Create memory_util function function memory_util ()īUFFCACHE_MEM=$(free -m | awk '/Mem/ ') disk_util will tell the disk used and disk available of the root partition and home partition.cpu_util will give information about CPU load and CPU usage and tell whether the CPU is performing well or not.memory_util will give information about Available memory, Free memory, Memory Used Percentage, etc., as well as reports on whether the memory is healthy or not.The main function will call three functions as follows : Step 2: Create Main Function function main () Open the file and add the following script : #!/bin/bashĮcho "The valid syntax is. ISRO CS Syllabus for Scientist/Engineer Exam.ISRO CS Original Papers and Official Keys.GATE CS Original Papers and Official Keys.DevOps Engineering - Planning to Production.Python Backend Development with Django(Live).Android App Development with Kotlin(Live).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |