#!/bin/bash if [ "$EUID" -ne 0 ] then echo "Please run as root" exit fi #set -x msg() { ./ssd1306_bin "$@" } netaddrs() { ip -p -o -br -4 address show | ( current_line=1 while IFS= read -r line; do IFS=' ' read -r -a iface <<< "$line" if [[ "${iface[0]}" == lo* ]]; then continue fi msg -x0 -y$current_line -m "${iface[0]} ${iface[1]} " ((current_line=current_line+1)) if [[ ${#iface[@]} -gt 2 ]]; then for addr in ${iface[@]:2}; do msg -x4 -y$current_line -l "${addr}" ((current_line=current_line+1)) done fi done ) } title=`hostname` COLUMNS=15 text="`printf "%*s\n" $(((${#title}+$COLUMNS)/2)) "$title"`" msg -I 128x64 -c -i 0 -x 0 -y 0 -f 1 -l "$text" while true; do netaddrs msg -f 0 -x 8 -y 6 -l "`date '+%Y-%m-%d %H:%M:%S'`" msg -x0 -y7 -l "`cut -d" " -f1-3 /proc/loadavg`" sleep 1 done