Created
October 11, 2018 06:42
-
-
Save notthetup/47cb251aa0135e1e09759e0dc5bb1a01 to your computer and use it in GitHub Desktop.
sysinfo motd for TX1
This file contains hidden or 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/sh | |
# | |
# Copy this file to /etc/update-motd.d/ | |
# Remove all other files from /etc/update-motd.d/ | |
date=`date` | |
load=`cat /proc/loadavg | awk '{print $1}'` | |
root_usage=`df -h / | awk '/\// {print $(NF-1)}'` | |
memory_usage=`free -m | awk '/Mem/ { printf("%3.1f%%", $3/$2*100) }'` | |
users=`users | wc -w` | |
ip_addr=$(ip a s $(ls /sys/class/net | grep eth[0-9]) | grep -w 'inet' | awk '{print $2}' | cut -d'/' -f1) | |
cpu_temp=$(cat /sys/devices/virtual/thermal/thermal_zone6/temp) | |
echo "System information as of: $date" | |
echo | |
printf "System load:\t%s\tMemory usage:\t%s\n" $load $memory_usage | |
printf "Usage on /:\t%s\tIP Address:\t%s\n" $root_usage $ip_addr | |
printf "Local users:\t%s\\tCPU Temp:\t%s\n" $users $(($cpu_temp/1000)) | |
echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment