Hello!
I have a question about a script to regulate the bandwidth for each user.
My doubt is the following:
Currently use this script which is run every 3 hours.
(
: Local user
: Local bytesin
: Local bytesout
: Local megstotal
: Local groupname
/ Tool user-manager user
: Foreach in i = [/ tool user-manager user find subscriber = admin] = do (
: Set user [$ i get name]
: Set bytesin [get $ i download-used]
: Set bytesout [get $ i upload-used]
: Set megstotal (($ bytesin + 1 + $ bytesout) / 1000000)
: Set groupname [$ i get group-]
: If (([$ megstotal] <15) & & ([$ groupname] = A)) = do (
/ Tool user-manager user set [/ tool user-manager user find name = $ user] rate-limit = “32k/32k 34k/64k 22k/25k 18000/18000 6 16k/32k”
: $ User log info
: $ Info log groupname
: Log info “Total Used MB = $ megstotal”
: Log info “user uan continue to 64/128 were not falling too much”)
: If (([$ megstotal]> 15) & & ([$ groupname] = A)) = do (
/ Tool user-manager user set [/ tool user-manager user find name = $ user] rate-limit = “32k/32k 33k/33k 24k/24k 180000/180000 6 16k/32k”
: $ User log info
: $ Info log groupname
: Log info “Total Used MB = $ megstotal”
: Log info “punished 32k/32k”)
: If (([$ megstotal] <51) & & ([$ groupname] = B)) = do (
/ Tool user-manager user set [/ tool user-manager user find name = $ user] rate-limit = “128k/128k 256k/256k 64k/64k 1800/1800 5 16k/32k”
: $ User log info
: $ Info log groupname
: Log info “Total Used MB = $ megstotal”
: Log info “User Rate Limit set to 128/256 with burst up to 256k/512k with average 64/128k prority 5”)
: If (([$ megstotal]> 51) & & ([$ groupname] = B)) = do (
/ Tool user-manager user set [/ tool user-manager user find name = $ user] rate-limit = “16k/16k 32k/32k 24k/24k 1800/1800 7 15k/15k”
: $ User log info
: $ Info log groupname
: Log info “Total Used MB = $ megstotal”
: Log info “User Rate Limit set to 64k/128k with burst up to 150k/512k with average 64k/128k priority 7”)
: If (([$ megstotal] <51) & & ([$ groupname] = C)) = do (
/ Tool user-manager user set [/ tool user-manager user find name = $ user] rate-limit = “128k/128k 256k/256k 64k/64k 18000/18000 5 16k/32k”
: $ User log info
: $ Info log groupname
: Log info “Total Used MB = $ megstotal”
: Log info “User Rate Limit set to 128/256 with burst up to 256k/512k with average 64/128k prority 5”)
: If (([$ megstotal]> 51) & & ([$ groupname] = C)) = do (
/ Tool user-manager user set [/ tool user-manager user find name = $ user] rate-limit = “32k/32k 34k/34k 24k/24k 180000/180000 7 16k/18k”
: $ User log info
: $ Info log groupname
: Log info “Total Used MB = $ megstotal”
: Log info “User Rate Limit set to 64k/128k with burst up to 64k/64k with average 24k/24k priority 7”)
: If (([$ megstotal] <101) & & ([$ groupname] = D)) = do (
/ Tool user-manager user set [/ tool user-manager user find name = $ user] rate-limit = “128k/256k 256k/512k 64k/64k 1800/1800 5 16k/32k”
: $ User log info
: $ Info log groupname
: Log info “Total Used MB = $ megstotal”
: Log info “User Rate Limit set to 128/256 with burst up to 256k/512k with average 64/128k prority 4”)
: If (([$ megstotal]> 101) & & ([$ groupname] = D)) = do (
/ Tool user-manager user set [/ tool user-manager user find name = $ user] rate-limit = “32k/32k 34k/34k 24k/24k 180000/180000 7 16k/32k”
: $ User log info
: $ Info log groupname
: Log info “Total Used MB = $ megstotal”
: Log info “User Rate Limit set to 64k/128k with burst up to 64k/64k with average 24k/24k priority 6”)
)
)
The issue is that for actually decrease the speed to exceed the limit of discharge I have another script that compels the user log out of your system and thus able to assign another bandwidth.
My doubt is that if there is any way to avoid forcing users to opt out of the system to assign another bandwidth?