Skip to content

Instantly share code, notes, and snippets.

@K-Ko
Last active July 9, 2017 13:01
Show Gist options
  • Save K-Ko/7eb8d2e8abdf36195efe6e1d814907b9 to your computer and use it in GitHub Desktop.
Save K-Ko/7eb8d2e8abdf36195efe6e1d814907b9 to your computer and use it in GitHub Desktop.
Dyn. motd for debain based systems
#!/bin/bash
###
### sudo wget -qO /usr/local/bin/dynmotd https://gist.github.com/K-Ko/7eb8d2e8abdf36195efe6e1d814907b9/raw/dynmotd
### sudo chmod +x /usr/local/bin/dynmotd
### echo /usr/local/bin/dynmotd >> ~/.profile
###
echo
uname -srvm
echo
echo $(uptime -p) since $(uptime -s)
echo
echo -----------------------------------------------------------------------------
temp=/sys/class/thermal/thermal_zone0/temp
if [ -f $temp ]; then
### Raspberry Pi
printf " "
awk '{ printf "Load average: %.2f / %.2f / %.2f", $1, $2, $3 }' /proc/loadavg
printf " | "
awk '{ printf "Temperature: %.1f°C", $1/1000 }' $temp
else
printf " "
awk '{ printf "Load average: %.2f / %.2f / %.2f", $1, $2, $3 }' /proc/loadavg
fi
echo
echo -----------------------------------------------------------------------------
free -h | head -n 2
echo -----------------------------------------------------------------------------
df -h -x tmpfs -x devtmpfs
echo -----------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment