Created
November 5, 2019 00:49
-
-
Save brunomiguel/efa59fe50a0ad361dbe99edb33aa02f0 to your computer and use it in GitHub Desktop.
motd
This file contains 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
#! /usr/bin/env bash | |
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) | |
# Basic info | |
HOSTNAME=`uname -n` | |
ROOT=`df -Ph | grep -w nbd0p1 | awk '{print $4}' | tr -d '\n'` | |
# System load | |
MEMORY1=`free -t -m | grep Total | awk '{print $3" MB";}'` | |
MEMORY2=`free -t -m | grep "Mem" | awk '{print $2" MB";}'` | |
LOAD1=`cat /proc/loadavg | awk {'print $1'}` | |
LOAD5=`cat /proc/loadavg | awk {'print $2'}` | |
LOAD15=`cat /proc/loadavg | awk {'print $3'}` | |
cat << 'EOF' | |
. . . . . . . . . + . | |
. . : . .. :. .___---------___. | |
. . . . :.:. _".^ .^ ^. '.. :"-_. . | |
. : . . .:../: . .^ :.:\. | |
. . :: +. :.:/: . . . . . .:\ | |
. : . . _ :::/: . ^ . . .:\ | |
.. . . . - : :.:./. . .:\ | |
. . . :..|: . . ^. .:| | |
. . : : ..|| . . . !:| | |
. . . . ::. ::\( . :)/ | |
. . : . : .:.|. ###### .#######::| | |
:.. . :- : .: ::|.####### ..########:| | |
. . . .. . .. :\ ######## :######## :/ | |
. .+ :: : -.:\ ######## . ########.:/ | |
. .+ . . . . :.:\. ####### #######..:/ | |
:: . . . . ::.:..:.\ . . ..:/ | |
. . . .. : -::::.\. | | . .:/ | |
. : . . .-:.":.::.\ ..:/ | |
. -. . . . .: .:::.:.\. .:/ | |
. . . : : ....::_:..:\ ___. :/ | |
. . . .:. .. . .: :.:.:\ :/ | |
+ . . : . ::. :.:. .:.|\ .:/| | |
. + . . ...:: ..| --.:| | |
. . . . . . . ... :..:.."( ..)" | |
. . . : . .: ::/ . .::\ | |
EOF | |
echo -e " | |
=============================================== | |
- Hostname............: $HOSTNAME | |
- Uptime..............: $UPTIME_DAYS days, $UPTIME_HOURS hours, $UPTIME_MINUTES minutes | |
- Disk Space..........: $ROOT remaining | |
=============================================== | |
- CPU usage...........: $LOAD1, $LOAD5, $LOAD15 (1, 5, 15 min) | |
- Memory used.........: $MEMORY1 / $MEMORY2 | |
- Swap in use.........: `free -m | tail -n 1 | awk '{print $3}'` MB | |
=============================================== | |
" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment