Skip to content

Instantly share code, notes, and snippets.

@rgr-dev
Last active August 8, 2020 20:53
Show Gist options
  • Save rgr-dev/4cb77f83fd4017c27ee89169ff4ddac0 to your computer and use it in GitHub Desktop.
Save rgr-dev/4cb77f83fd4017c27ee89169ff4ddac0 to your computer and use it in GitHub Desktop.
Modified motd for raspberry pi post-auth prompt
#!/bin/bash
upSeconds="$(/usr/bin/cut -d. -f1 /proc/uptime)"
secs=$((${upSeconds}%60))
mins=$((${upSeconds}/60%60))
hours=$((${upSeconds}/3600%24))
days=$((${upSeconds}/86400))
UPTIME=`printf "%d days, %02dh%02dm%02ds" "$days" "$hours" "$mins" "$secs"`
# get the load averages
# read -r one five fifteen rest < /proc/loadavg
echo "$(tput setaf 2)
.~~. .~~. `date +"%A, %e %B %Y, %r"`
'. \ ' ' / .' `uname -srmo`$(tput setaf 1)
.~ .~~~..~.
: .~.'~'.~. : Uptime.............: ${UPTIME}
~ ( ) ( ) ~ Memory.............: `free -m | awk 'NR==2 { printf "Total: %sMB, Used: %sMB, Free: %sMB",$2,$3,$4; }'`
( : '~'.~.'~' : ) CPU Temperature....: `exec -- /opt/vc/bin/vcgencmd measure_temp | cut -c "6-9"`
~ .~ ( ) ~. ~ Running Processes..: `ps ax | wc -l | tr -d " "`
( : '~' : ) Disk Space.........: `df -h ~ | awk 'NR==2 { printf "Total: %sB, Used: %sB, Free: %sB",$2,$3,$4; }'`
'~ .~~~. ~' Weather............: `curl -s "http://rss.accuweather.com/rss/liveweather_rss.asp?metric=1&locCode=SAM|AR|AR001|AVELLANEDA" | sed -n '/Currently:/ s/.*: \(.*\): \([0-9]*\)\([CF]\).*/\2°\3, \1/p'`
'~'
$(tput sgr0)"
@rgr-dev
Copy link
Author

rgr-dev commented Aug 8, 2020

AccuWeather LocCodes
https://pastebin.com/dbtemx5F

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment