slitaz-arm diff tools/example.cgi @ rev 219

dot command may not search current directory first
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Jul 23 13:50:45 2017 +0200 (2017-07-23)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/tools/example.cgi	Sun Jul 23 13:50:45 2017 +0200
     1.3 @@ -0,0 +1,37 @@
     1.4 +#!/bin/sh
     1.5 +#
     1.6 +# Tiny CGI SHell example for SliTaz ARM
     1.7 +#
     1.8 +# $ startd httpd
     1.9 +# URL: http://rpi.ip/adm/
    1.10 +#
    1.11 +echo "Content type: text/plain"
    1.12 +echo ""
    1.13 +
    1.14 +# Only for root
    1.15 +[ $(id -u) == 0 ] || exit 1
    1.16 +
    1.17 +cpu_temp() {
    1.18 +	awk '{printf "%3.1f C", $1/1000}' \
    1.19 +		/sys/class/thermal/thermal_zone0/temp
    1.20 +}
    1.21 +
    1.22 +# tazberry rpi_stats
    1.23 +cat << EOT
    1.24 +SliTaz Raspberry Pi Stats
    1.25 +-------------------------
    1.26 +
    1.27 +Kernel   : $(uname -snrm)
    1.28 +Uptime   :$(uptime | cut -d "," -f 1,2)
    1.29 +CPU Temp : $(cpu_temp)
    1.30 +
    1.31 +Memory and filesystem usages
    1.32 +----------------------------
    1.33 +$(free -m)
    1.34 +
    1.35 +$(df -h)
    1.36 +
    1.37 +Network interfaces
    1.38 +------------------
    1.39 +$(ifconfig)
    1.40 +EOT