Last active
June 9, 2016 00:50
-
-
Save ayman/e43abd3922dcb72a0f9925dba2b2db79 to your computer and use it in GitHub Desktop.
Display a pretty status on a Raspberry Pi. I forget where I found the base script, but this has a few modifications.
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
#!/bin/bash | |
## zip=94114 | |
zip="ASI|SG|SN---|SINGAPORE" | |
if [ -n "$1" ]; then | |
zip="$1" | |
fi | |
ip=`ip addr show scope global | grep inet | cut -d' ' -f6 | cut -d/ -f1 | tr "\n" " "` | |
oip=`wget -q -O - http://icanhazip.com/ | tail` | |
## up=`uptime | awk -F"up " '{print $2}' | awk -F"," '{print $1}'` | |
up=`uptime | cut -f 4,5 -d " " | cut -f 1 -d ,` | |
used=`df -h | grep 'dev/root' | awk '{print $3}'` | |
## avail=`df -h | grep 'dev/root' | awk '{print $4}'` | |
total=`df -h | grep 'dev/root' | awk '{print $2}'` | |
weather=`curl -s "http://rss.accuweather.com/rss/liveweather_rss.asp?metric=1&locCode=$zip" | sed -n '/Currently:/ s/.*: \(.*\): \([0-9]*\)\([CF]\).*/\2°\3, \1/p'` | |
cpu=`/opt/vc/bin/vcgencmd measure_temp | cut -d = -f 2 | cut -d \' -f 1` | |
echo "$(tput setaf 2) | |
.~~. .~~. | |
'. \ ' ' / .'$(tput setaf 1) | |
.~ .~~~..~. | |
: .~.'~'.~. : $(tput setaf 6)host: $(tput bold; tput setaf 4)`hostname -f` $(tput sgr0; tput setaf 1) | |
~ ( ) ( ) ~ $(tput setaf 6)ip: $(tput setaf 3)${ip::-1} ($oip) $(tput sgr0; tput setaf 1) | |
( : '~'.~.'~' : ) $(tput setaf 6)cpu: $(tput setaf 3)$cpu°C $(tput sgr0; tput setaf 1) | |
~ .~ ( ) ~. ~ $(tput setaf 6)disk: $(tput setaf 3)$used / $total $(tput sgr0; tput setaf 1) | |
( : '~' : ) $(tput setaf 6)uptime: $( tput setaf 3)$up $(tput sgr0; tput setaf 1) | |
'~ .~~~. ~' $(tput setaf 6)weather: $(tput setaf 3)$weather $(tput sgr0; tput setaf 1) | |
'~' | |
$(tput sgr0)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment