luci-app-serverchan: sync with upstream source

This commit is contained in:
CN_SZTL 2020-05-23 18:57:16 +08:00
parent 05654fe99c
commit 38b39b4159
No known key found for this signature in database
GPG Key ID: 6850B6345C862176

View File

@ -164,7 +164,7 @@ function usage(){
[ ! -f "${dir}usage.db" ] && echo `bytes_for_humans 0` && return
[ -z "$total_n" ] && total_n=`cat ${dir}usage.db|head -n1|grep "total"|sed 's/,/\n/g'|awk '/total/{print NR}'` 2>/dev/null
[ -z "$total_n" ] && total_n="6"
[ "$2" ] && local tmptotal=`cat ${dir}usage.db|sed 's/,/ /g'|grep -i -w ${2}|awk "{print "'$'$total_n"}"|grep -v "^$"|sort -u` 2>/dev/null
[ "$2" ] && local tmptotal=`cat ${dir}usage.db|sed 's/,,,/,0,0,/g'|sed 's/,,/,0,/g'|sed 's/,/ /g'|grep -i -w ${2}|awk "{print "'$'$total_n"}"|grep -v "^$"|sort -u` 2>/dev/null
[ -z "$tmptotal" ] && local tmptotal="0"
[ ! "$3" ] && echo `bytes_for_humans ${tmptotal}` || echo $tmptotal
elif [ $1 == "down" ] ;then
@ -873,4 +873,4 @@ while [ "$serverchan_enable" -eq "1" ]; do
sleep $sleeptime
done
sleep $sleeptime
done
done