firmware/src/packages/fff/fff-web/files/www/ssl/cgi-bin/helpers
Adrian Schmutzler dbc1dddb23 fff-web: Suppress error if WAN/mesh statistics files are missing
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: Tim Niemeyer <tim@tn-x.org>
2017-09-17 17:06:34 +02:00

24 lines
458 B
Plaintext
Executable File

#!/usr/bin/haserl
<%
human_bytes() {
while read B ; do
[ $B -lt 1024 ] && echo ${B} B && return
KB=$(((B+512)/1024))
[ $KB -lt 1024 ] && echo ${KB} KB && return
MB=$(((KB+512)/1024))
[ $MB -lt 1024 ] && echo ${MB} MB && return
GB=$(((MB+512)/1024))
[ $GB -lt 1024 ] && echo ${GB} GB && return
echo $(((GB+512)/1024)) TB && return
done
echo "-"
}
show_msg() {
if [ "$MSG" != "" ] ; then
echo "<div class=\"msg\">${MSG}</div>"
fi
}
%>