2018-12-02 23:43:08 +00:00
|
|
|
#!/bin/bash
|
2018-12-03 14:22:12 +00:00
|
|
|
set -euo pipefail
|
2018-12-02 23:43:08 +00:00
|
|
|
|
2018-12-03 14:22:12 +00:00
|
|
|
mem_use=$(free | awk '/Mem:/{ printf "%.0f", (($2 - $7) / $2) * 100 }')
|
2018-12-02 23:43:08 +00:00
|
|
|
|
2018-12-03 14:22:12 +00:00
|
|
|
color='#ffffff'
|
|
|
|
[ ${mem_use} -gt 70 ] && color='#ffd966'
|
|
|
|
[ ${mem_use} -gt 90 ] && color='#dd0000'
|
|
|
|
|
|
|
|
printf '\uf85a <span color="%s">%.0f%%</span>' ${color} ${mem_use}
|