Skip to content

Instantly share code, notes, and snippets.

@malte-j
Created October 2, 2018 22:30
Show Gist options
  • Save malte-j/55a74d37fdb054a1faf93427881eafef to your computer and use it in GitHub Desktop.
Save malte-j/55a74d37fdb054a1faf93427881eafef to your computer and use it in GitHub Desktop.
MOTD for Mazebot, put this in /etc/update-motd.d/
#!/bin/sh
upSeconds="$(/usr/bin/cut -d. -f1 /proc/uptime)"
secs=$((${upSeconds}%60))
mins=$((${upSeconds}/60%60))
hours=$((${upSeconds}/3600%24))
days=$((${upSeconds}/86400))
UPTIME=`printf "%dd %02dh %02dm %02ds" "$days" "$hours" "$mins" "$secs"`
# get the load averages
read one five fifteen rest < /proc/loadavg
echo "
• ▌ ▄ ·. ▄▄▄· ·▄▄▄▄•▄▄▄ .▄▄▄▄· ▄▄▄▄▄
·██ ▐███▪▐█ ▀█ ▪▀·.█▌▀▄.▀·▐█ ▀█▪▪ •██
▐█ ▌▐▌▐█·▄█▀▀█ ▄█▀▀▀•▐▀▀▪▄▐█▀▀█▄ ▄█▀▄ ▐█.▪
██ ██▌▐█▌▐█ ▪▐▌█▌▪▄█▀▐█▄▄▌██▄▪▐█▐█▌.▐▌ ▐█▌·
▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀ • ▀▀▀ ·▀▀▀▀ ▀█▄▀▪ ▀▀▀
Uptime.............: ${UPTIME}
Memory.............: $(free -m | awk 'NR==2 { printf "%sMB / %sMB used",$3,$2; }')
Storage............: $(df -h | awk 'NR==2 { printf "%sB / %sB used",$3,$2; }')
Load Averages......: ${one}, ${five}, ${fifteen} (1, 5, 15 min)
IP Addresses.......: `ip a | grep glo | awk '{print $2}' | head -1 | cut -f1 -d/` and `wget -q -O - https://canihazip.com/s | tail`
CPU Temperature....: $(/opt/vc/bin/vcgencmd measure_temp | cut -c "6-9")ºC
"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment