12345678910111213141516171819202122232425262728293031323334353637383940 |
- #!/bin/sh
- LOGIN=$1
- IP=$2
- CASH=$3
- ID=$4
- SPEED=`/etc/stargazer/GetSpeed $LOGIN`
- UPSPEED=`/etc/stargazer/GetUpSpeed $LOGIN`
- MAC=`/etc/stargazer/GetMac $LOGIN`
- SCOUNT="Kbit/s"
- fwcmd="/sbin/ipfw -q"
- arpcmd="/usr/sbin/arp"
- cur_date=`date \+\%Y.\%m.\%d`
- cur_time=`date \+\%H:\%M:\%S`
- # fix user mac to ip
- ${arpcmd} -S $IP $MAC
- #SPEED CONTROL
- ${fwcmd} pipe `expr $ID + 101` config bw $UPSPEED$SCOUNT queue 128Kbytes
- ${fwcmd} pipe `expr $ID + 32101` config bw $SPEED$SCOUNT queue 128Kbytes
- # SHAPER
- ${fwcmd} table 3 add $IP `expr $ID + 101`
- ${fwcmd} table 4 add $IP `expr $ID + 32101`
- ${fwcmd} table 47 delete $IP
- # DAY/NIGHT switcher
- /bin/echo $SPEED:`expr $ID + 32101` > /etc/stargazer/dn/$LOGIN
- /bin/chmod 777 /etc/stargazer/dn/$LOGIN
- # ADD TO LOG
- echo "$cur_date $cur_time CONNECT: ID-$ID;LOGIN-$LOGIN;IP-$IP;CASH-$CASH;SPEED-$SPEED;UPSPEED-$UPSPEED,MAC-$MAC" >> /var/stargazer/allconnect.log
|