Skip to content

Instantly share code, notes, and snippets.

@NghiaMaster
Last active October 20, 2019 16:16
Show Gist options
  • Save NghiaMaster/d9a8be73ebb56819bb780c7707ca6c08 to your computer and use it in GitHub Desktop.
Save NghiaMaster/d9a8be73ebb56819bb780c7707ca6c08 to your computer and use it in GitHub Desktop.
Print System Info to Screen
#!/bin/bash
bat=$(echo Battery: `cat /sys/class/power_supply/battery/capacity` %)
batstt=$(echo `cat /sys/class/power_supply/battery/status`)
loadavg=$(echo CPU LoadAvg: `cat /proc/loadavg`)
while true;
do
wget --spider --quiet https://google.com
if [ "$?" != 0 ]; then
stt=$(echo "Wifi Status: OFFLINE")
else
stt=$(echo "Wifi Status: ONLINE")
fi
wget --spider --quiet http://192.168.31.47/admin
if [ "$?" != 0 ]; then
pihole=$(echo "Pi-Hole: OFFLINE")
else
pihole=$(echo "Pi-Hole: ONLINE")
fi
convert -size 800x480 xc:black -pointsize 24 -fill white -undercolor '#00000080' -font Dejavu-Serif -draw\
"text 50,25 '$bat $batstt' \
text 50,55 '$stt' \
text 50,85 '$pihole' \
text 50,115 '$loadavg' \
text 45,475 '* Tự động làm mới sau 10 Giây ...'" -rotate 270 sysinfo.png
sleep 4
#convert -size 800x480 xc:black -pointsize 24 -fill white -undercolor '#00000080' -font Dejavu-Serif -draw\
#"text 50,25 '$bat $batstt' \
#text 50,55 '$stt' \
#text 50,85 '$pihole' \
#text 50,115 '$loadavg' \
#text 45,475 '* Tự động làm mới sau 10 Giây ...'" -rotate 270 sysinfo1.png
#sleep 4
sudo fbi -T 1 -d /dev/graphics/fb0 -a -noverbose -cachemem 0 sysinfo.png
sleep 4
killall -9 fbi
sleep 2
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment