Created
March 27, 2020 13:45
-
-
Save fabioperrella/71b1724809349c1265ae293143213fc9 to your computer and use it in GitHub Desktop.
Bash script to print the memory usage in syslog every 2s
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
while :; do | |
mem_used="$(free -m | grep Mem | awk '{print$3}')" | |
mem_free="$(free -m | grep Mem | awk '{print$4}')" | |
mem_avail="$(free -m | grep Mem | awk '{print$4}')" | |
logger -t MemWatcher "Used: ${mem_used}. Free: ${mem_free}. Available: ${mem_avail}."; | |
sleep 2; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment