-
-
Save nekocentral/667485ebb58b848a5cf46e31741f9cf0 to your computer and use it in GitHub Desktop.
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 | |
UPTIME_DAYS=$(expr `cat /proc/uptime | cut -d '.' -f1` % 31556926 / 86400) | |
UPTIME_HOURS=$(expr `cat /proc/uptime | cut -d '.' -f1` % 31556926 % 86400 / 3600) | |
UPTIME_MINUTES=$(expr `cat /proc/uptime | cut -d '.' -f1` % 31556926 % 86400 % 3600 / 60) | |
cat > /etc/motd << EOF | |
┌───────────────────────────────────────────────────────────────────────────┐ | |
│ ______ ______ __ __ __ __ __ __ __ __ │ | |
│ /\__ _\ /\ ___\ /\ \/\ \ /\ "-./ \ /\ \ /\ \/ / /\ \ │ | |
│ \/_/\ \/ \ \___ \ \ \ \_\ \ \ \ \-./\ \ \ \ \ \ \ _"-. \ \ \ │ | |
│ \ \_\ \/\_____\ \ \_____\ \ \_\ \ \_\ \ \_\ \ \_\ \_\ \ \_\ │ | |
│ \/_/ \/_____/ \/_____/ \/_/ \/_/ \/_/ \/_/\/_/ \/_/ │ | |
│ │ | |
├───────────────────────────────System Info─────────────────────────────────┤ | |
│ Uptime: $UPTIME_DAYS days, $UPTIME_HOURS hours, $UPTIME_MINUTES minutes │ | |
│ Distro: `awk -F= '$1=="PRETTY_NAME" {gsub(/"/, "", $2); print $2 ;}' /etc/os-release` Kernel: `uname -r` │ | |
│ CPU:`cat /proc/cpuinfo | grep 'model name' | head -1 | cut -d':' -f2` │ | |
│ CPU Load: `cat /proc/loadavg | awk '{print $1 ", " $2 ", " $3}'` CPU Temp: `sensors | sed -rn 's/.*SMBUSMASTER 0:\s+([^ ]+).*/\1/p' | sed 's/+//g'` │ | |
├───────────────────────────────Memory Info─────────────────────────────────┤ | |
│ Memory: `free -t | awk 'NR == 2 {printf("%.2f%"), $3/$2*100}'`% used of `free -m | head -n 2 | tail -n 1 | awk {'print $2'}`M Swap: `free -t | awk 'NR == 3 {printf("%.2f%"), $3/$2*100}'`% used of `free -m | tail -n 1 | awk {'print $2'}`M │ | |
├───────────────────────────────Network Info────────────────────────────────┤ | |
│ eth0 Address: `ifconfig eth0 | grep "inet addr" | awk -F: '{print $2}' | awk '{print $1}'` eth1 Address: `ifconfig eth1 | grep "inet addr" | awk -F: '{print $2}' | awk '{print $1}'` │ | |
│ eth0 WAN IP: `curl -s --interface eth0 icanhazip.org` eth1 WAN IP: `curl -s --interface eth1 icanhazip.org` │ | |
├───────────────────────────────Storage Info────────────────────────────────┤ | |
│ Usage of /: `df -h / | awk '{ b = $4 } END { print b }'` of `df -h / | awk '{ a = $1 } END { print a }'` Usage of /mnt/torrents: `df -h /mnt/torrents | awk '{ b = $4 } END { print b }'` of `df -h /mnt/torrents | awk '{ a = $1 } END { print a }'` │ | |
│ Usage of /mnt/backup: `df -h /mnt/backup | awk '{ b = $4 } END { print b }'` of `df -h /mnt/backup | awk '{ a = $1 } END { print a }'` Usage of /mnt/tv: `df -h /mnt/tv | awk '{ b = $4 } END { print b }'` of `df -h /mnt/tv | awk '{ a = $1 } END { print a }'` │ | |
│ Usage of /mnt/ebooks: `df -h /mnt/ebooks | awk '{ b = $4 } END { print b }'` of `df -h /mnt/ebooks | awk '{ a = $1 } END { print a }'` Usage of /mnt/vm: `df -h /mnt/vm | awk '{ b = $4 } END { print b }'` of `df -h /mnt/vm | awk '{ a = $1 } END { print a }'` │ | |
└───────────────────────────────────────────────────────────────────────────┘ | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment