#!/bin/sh
#This script is created by ssparser automatically. The parser first created by MaoShouyan
printf "Content-type: text/html;charset=gb2312
Cache-Control: no-cache

"
echo -n "";
if [ -f ${RAMDISK}/PG.conf ]; then
	. ${RAMDISK}/PG.conf
	PGPATH="${RAMDISK}"
else
	. /etc/PG.conf
fi
FLOWEYE=${PGPATH}/bin/floweye
firstelem=1
printf "["
${FLOWEYE} ixcache list | while read id name proxy ip nexthop state rteid mirrors hits ttl freever filenum version theothers
do
	[ "${version}" = "NULL" ] && version=""
	if [ ${firstelem} -eq 1 ]; then
		printf "{'id':'${id}','state':'${state}','mirrors':'${mirrors}','hits':'${hits}','freever':'${freever}','filenum':'${filenum}','version':'${version}'}"
		firstelem=0
	else
		printf ",{'id':'${id}','state':'${state}','mirrors':'${mirrors}','hits':'${hits}','freever':'${freever}','filenum':'${filenum}', 'version':'${version}'}"
	fi
done
echo "]"

echo -n "
";