Skip to content

Instantly share code, notes, and snippets.

@notthetup
Created October 11, 2018 06:42
Show Gist options
  • Save notthetup/47cb251aa0135e1e09759e0dc5bb1a01 to your computer and use it in GitHub Desktop.
Save notthetup/47cb251aa0135e1e09759e0dc5bb1a01 to your computer and use it in GitHub Desktop.
sysinfo motd for TX1
#!/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