Vedel by ho niekdo upravit tento script pre QT? pls.
# FUP
# pripraveno pouze pro Queue Simple.
# Created by AMC (xxx@sxxx.cz)
# PARAMETRY
# limity pri kterych se FUP zapne v kbps
:local limitOutMax
:set limitOutMax 120
:local limitInMax
:set limitInMax $limitOutMax
# limity pri kterych se FUP vypne v kbps
:local limitOutMin
:set limitOutMin 10
:local limitInMin
:set limitInMin $limitOutMin
# prepocet limitu na bytes/h (resp. na interval, v jakem se skript spousti)
:set limitOutMax ($limitOutMax*512/8*60*60)
:set limitInMax ($limitInMax*1024/8*60*60)
:set limitOutMin ($limitOutMin*512/8*60*60)
:set limitInMin ($limitInMin*1024/8*60*60)
#/tool e-mail send to=net4fan@centrum.sk subject=([/system identity get name] . " 1 FUP") body=("verze0 Out = " . $limitOutMax . " In = " . $limitInMax)
# Pracovni promenne
:local name
:local dsta
:local p2p
:local traf
:local bytesOut
:local bytesIn
:local index
:local currentLimit
:local currentLimitOut
:local currentLimitIn
/queue simple
:foreach i in=[/queue simple find] do {
:set name [get $i name]
:set dsta [get $i dst-address]
:set p2p [get $i p2p]
# vybereme jen spravne zaznamy v QS
:if ($dsta="0.0.0.0/0" && $p2p!="all-p2p") do {
:set traf [get $i bytes]
:set index -1
# v traf najdeme znak /
:do {
:set index ($index + 1)
} while ( [:pick $traf $index]!="/" && $index<40 )
# jeli znak nalezen
:if ($index<40) do {
# z traf vyrizneme bytesOut a bytesIn
:set bytesOut [:pick $traf 0 $index]
:set index ($index + 1)
:set bytesIn [:pick $traf $index [:len $traf]]
# aktualne nastaveny limit
:set currentLimit [get $i max-limit]
# v currentLimit najdeme znak /
:set index -1
:do {
:set index ($index + 1)
} while ( [:pick $currentLimit $index]!="/" && $index<40 )
# jeli znak nalezen
:if ($index<40) do {
# z traf vyrizneme bytesOut a bytesIn
:set currentLimitOut [:pick $currentLimit 0 $index]
:set index ($index + 1)
:set currentLimitIn [:pick $currentLimit $index [:len $currentLimit]]
}
:if ($bytesOut > $limitOutMaxup) do {
/tool e-mail send to=net4fan@centrum.sk subject=([/system identity get name] . " 2 FUP") body=("verze0 uzivatel " . $name . " prekrocil limit Out = " . $bytesOut . " > " . $limitOutMaxup)
# omezime rychlost
set $i max-limit=64000/256000
}
:if ($bytesIn > $limitInMax) do {
/tool e-mail send to=net4fan@centrum.sk subject=([/system identity get name] . " 3 FUP") body=("verze0 uzivatel " . $name . " prekrocil limit In = " . $bytesIn . " > " . $limitInMax)
# omezime rychlost
set $i max-limit=128000/256000
}
:if ($bytesOut <= $limitOutMin && $bytesIn <= $limitInMin) do {
# povolime rychlost
set $i max-limit=256000/1024000
}
}
}
}
dufam ze sa autor nebude hnevat :)
Alebo ma niekto nejaky funkcny? Dik