#!/bin/sh

. /etc/PG.conf

iftop_status()
{
	enable=`/usr/ramdisk/bin/floweye iftop stat | grep "^enable=" | cut -d'=' -f2`
	if [ "${enable}" = "0" ]; then
		echo "disable"
	else
		echo "enable"
	fi
}
	
iftop_start()
{
	mkdir -p /usr/ramdisk/admin/cgi-bin/App/iftop
	cp -rf ${PGPATH}/app/iftop/webmain /usr/ramdisk/admin/cgi-bin/App/iftop/
}

iftop_stop()
{
	iftop_disable
}

iftop_enable()
{
	/usr/ramdisk/bin/floweye iftop config enable=1
}

iftop_disable()
{
	/usr/ramdisk/bin/floweye iftop config enable=0
}

case "$1" in 
"start")
	iftop_start	
	;;
"stop")
	iftop_stop
	;;

"enable")
	iftop_enable
	;;

"disable")
	iftop_disable
	;;

"status")
	iftop_status
	;;

"unload")
	;;

*)
	echo "unknown action!"
	;;
esac

