System information, memory info was not working in xenial, IP addresses divided by comma
This commit is contained in:
parent
9fb34c5607
commit
51f54e4ebe
@ -79,17 +79,21 @@ if [[ -e "$axp_dir" && -e "$axp_dir/battery" ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
load=$(cat /proc/loadavg | awk '{print $1}')
|
||||
memory_usage=$(free | awk '/Mem/ {printf("%.0f",(($2-($4+$6+$7))/$2) * 100)}')
|
||||
# workaround that it works on old and new
|
||||
free -w &> /dev/null
|
||||
if [[ $? -ne 0 ]]; then
|
||||
memory_usage=$(free | awk '/Mem/ {printf("%.0f",(($2-($4+$6+$7))/$2) * 100)}')
|
||||
else
|
||||
memory_usage=$(free -w | awk '/Mem/ {printf("%.0f",(($2-($4+$6+$7))/$2) * 100)}')
|
||||
fi
|
||||
memory_total=$(free -m | awk '/Mem/ {print $(2)}')
|
||||
users=$(users | wc -w)
|
||||
swap_usage=$(free -m | ( awk '/Swap/ { printf("%3.0f", $3/$2*100) }' 2>/dev/null || echo 0 ) | sed 's/ //g')
|
||||
swap_usage=${swap_usage//[!0-9]/} # to remove alfanumeric if swap not used
|
||||
swap_total=$(free -m | awk '/Swap/ {print $(2)}')
|
||||
ip_address=$(hostname -I | tr " " "\n" | grep -E "^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" | tail -n2 | tr "\n" " ")
|
||||
ip_address=$(echo $ip_address | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | sed 's/ /,/g')
|
||||
root_usage=$(df -h / | awk '/\// {print $(NF-1)}' | sed 's/%//g')
|
||||
root_total=$(df -h / | awk '/\// {print $(NF-4)}')
|
||||
if [ -e "$storage" ]; then
|
||||
|
||||
Loading…
Reference in New Issue
Block a user