Skip to content

Commit

Permalink
Parse os-release if possible
Browse files Browse the repository at this point in the history
  • Loading branch information
pdostal committed Oct 17, 2023
1 parent e2d37eb commit 2d7a3ca
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion motd
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ if [[ ${OSTYPE,,} =~ ^linux ]]; then
loadAvg="$(awk '{ printf "%s, %s, %s", $1, $2, $3 }' /proc/loadavg)"
diskUsage=$(df -h /| awk '$NF=="/"{printf "%s", $5}')
memUsage=$(free -m | awk 'NR==2{printf "%.2f%%", $3*100/$2 }')
echo "$(uname -s) $(uname -r) $(uname -p) - Up ${upDays} days"
osRelease=$(test -f /etc/os-release && source /etc/os-release && echo -n " ${NAME} ${VERSION}")
echo "$(uname -o)${osRelease} $(uname -r | cut -d'.' -f1,2) $(uname -p) - Up ${upDays} days"
echo "Load: ${loadAvg} Disk: ${diskUsage} Memory: ${memUsage}"
fi

Expand Down

0 comments on commit 2d7a3ca

Please sign in to comment.