Community discussions

MikroTik App
 
namo
Long time Member
Long time Member
Topic Author
Posts: 530
Joined: Sat Oct 03, 2009 4:44 pm

why this scrip is not working any more?

Fri Sep 28, 2012 11:46 am

I have RouterOS v5.30
This script used to work but I don't know if I changed something that make doesn't work
:local day [:pick [/system clock get date] 4 6];
:if ($day = "01") do={
/ip hotspot user profile set [/ip hotspot user profile find name="0400kbps money"] advertise-interval=6h
/ip hotspot user profile set [/ip hotspot user profile find name="0800kbps money"] advertise-interval=6h
/ip hotspot user profile set [/ip hotspot user profile find name="1000kbps money"] advertise-interval=6h
/ip hotspot user profile set [/ip hotspot user profile find name="1200kbps money"] advertise-interval=6h
/ip hotspot user profile set [/ip hotspot user profile find name="1500kbps money"] advertise-interval=6h
/ip hotspot user profile set [/ip hotspot user profile find name="1600kbps money"] advertise-interval=6h
/ip hotspot user profile set [/ip hotspot user profile find name="2000kbps money"] advertise-interval=6h
}
:if ($day = "02") do={
/ip hotspot user profile set [/ip hotspot user profile find name="0400kbps money"] advertise-interval=5h
/ip hotspot user profile set [/ip hotspot user profile find name="0800kbps money"] advertise-interval=5h
/ip hotspot user profile set [/ip hotspot user profile find name="1000kbps money"] advertise-interval=5h
/ip hotspot user profile set [/ip hotspot user profile find name="1200kbps money"] advertise-interval=5h
/ip hotspot user profile set [/ip hotspot user profile find name="1500kbps money"] advertise-interval=5h
/ip hotspot user profile set [/ip hotspot user profile find name="1600kbps money"] advertise-interval=5h
/ip hotspot user profile set [/ip hotspot user profile find name="2000kbps money"] advertise-interval=5h	
}
:if ($day = "03") do={
/ip hotspot user profile set [/ip hotspot user profile find name="0400kbps money"] advertise-interval=4h
/ip hotspot user profile set [/ip hotspot user profile find name="0800kbps money"] advertise-interval=4h
/ip hotspot user profile set [/ip hotspot user profile find name="1000kbps money"] advertise-interval=4h
/ip hotspot user profile set [/ip hotspot user profile find name="1200kbps money"] advertise-interval=4h
/ip hotspot user profile set [/ip hotspot user profile find name="1500kbps money"] advertise-interval=4h
/ip hotspot user profile set [/ip hotspot user profile find name="1600kbps money"] advertise-interval=4h
/ip hotspot user profile set [/ip hotspot user profile find name="2000kbps money"] advertise-interval=4h	
}
:if ($day = "04") do={
/ip hotspot user profile set [/ip hotspot user profile find name="0400kbps money"] advertise-interval=3h
/ip hotspot user profile set [/ip hotspot user profile find name="0800kbps money"] advertise-interval=3h
/ip hotspot user profile set [/ip hotspot user profile find name="1000kbps money"] advertise-interval=3h
/ip hotspot user profile set [/ip hotspot user profile find name="1200kbps money"] advertise-interval=3h
/ip hotspot user profile set [/ip hotspot user profile find name="1500kbps money"] advertise-interval=4h
/ip hotspot user profile set [/ip hotspot user profile find name="1600kbps money"] advertise-interval=3h
/ip hotspot user profile set [/ip hotspot user profile find name="2000kbps money"] advertise-interval=3h	
}
:if ($day = "05") do={
/ip hotspot user profile set [/ip hotspot user profile find name="0400kbps money"] advertise-interval=2h
/ip hotspot user profile set [/ip hotspot user profile find name="0800kbps money"] advertise-interval=2h
/ip hotspot user profile set [/ip hotspot user profile find name="1000kbps money"] advertise-interval=2h
/ip hotspot user profile set [/ip hotspot user profile find name="1200kbps money"] advertise-interval=2h
/ip hotspot user profile set [/ip hotspot user profile find name="1500kbps money"] advertise-interval=2h
/ip hotspot user profile set [/ip hotspot user profile find name="1600kbps money"] advertise-interval=2h
/ip hotspot user profile set [/ip hotspot user profile find name="2000kbps money"] advertise-interval=2h	
}
:if ($day = "06") do={
/ip hotspot user profile set [/ip hotspot user profile find name="0400kbps money"] advertise-interval=1h
/ip hotspot user profile set [/ip hotspot user profile find name="0800kbps money"] advertise-interval=1h
/ip hotspot user profile set [/ip hotspot user profile find name="1000kbps money"] advertise-interval=1h
/ip hotspot user profile set [/ip hotspot user profile find name="1200kbps money"] advertise-interval=1h
/ip hotspot user profile set [/ip hotspot user profile find name="1500kbps money"] advertise-interval=1h
/ip hotspot user profile set [/ip hotspot user profile find name="1600kbps money"] advertise-interval=1h
/ip hotspot user profile set [/ip hotspot user profile find name="2000kbps money"] advertise-interval=1h	
}
:if ($day = "07") do={
/ip hotspot user profile set [/ip hotspot user profile find name="0400kbps money"] advertise-interval=30m
/ip hotspot user profile set [/ip hotspot user profile find name="0800kbps money"] advertise-interval=30m
/ip hotspot user profile set [/ip hotspot user profile find name="1000kbps money"] advertise-interval=30m
/ip hotspot user profile set [/ip hotspot user profile find name="1200kbps money"] advertise-interval=30m
/ip hotspot user profile set [/ip hotspot user profile find name="1500kbps money"] advertise-interval=30m
/ip hotspot user profile set [/ip hotspot user profile find name="1600kbps money"] advertise-interval=30m
/ip hotspot user profile set [/ip hotspot user profile find name="2000kbps money"] advertise-interval=30m	
}
:if ($day = "08") do={
/ip hotspot user profile set [/ip hotspot user profile find name="0400kbps money"] advertise-interval=15m
/ip hotspot user profile set [/ip hotspot user profile find name="0800kbps money"] advertise-interval=15m
/ip hotspot user profile set [/ip hotspot user profile find name="1000kbps money"] advertise-interval=15m
/ip hotspot user profile set [/ip hotspot user profile find name="1200kbps money"] advertise-interval=15m
/ip hotspot user profile set [/ip hotspot user profile find name="1500kbps money"] advertise-interval=15m
/ip hotspot user profile set [/ip hotspot user profile find name="1600kbps money"] advertise-interval=15m
/ip hotspot user profile set [/ip hotspot user profile find name="2000kbps money"] advertise-interval=15m	
}
:if ($day = "09") do={
/ip hotspot user profile set [/ip hotspot user profile find name="0400kbps money"] advertise-interval=10m
/ip hotspot user profile set [/ip hotspot user profile find name="0800kbps money"] advertise-interval=10m
/ip hotspot user profile set [/ip hotspot user profile find name="1000kbps money"] advertise-interval=10m
/ip hotspot user profile set [/ip hotspot user profile find name="1200kbps money"] advertise-interval=10m
/ip hotspot user profile set [/ip hotspot user profile find name="1500kbps money"] advertise-interval=10m
/ip hotspot user profile set [/ip hotspot user profile find name="1600kbps money"] advertise-interval=10m
/ip hotspot user profile set [/ip hotspot user profile find name="2000kbps money"] advertise-interval=10m	
}
:if ($day = "10") do={
/ip hotspot user profile set [/ip hotspot user profile find name="0400kbps money"] advertise-interval=5m
/ip hotspot user profile set [/ip hotspot user profile find name="0800kbps money"] advertise-interval=5m
/ip hotspot user profile set [/ip hotspot user profile find name="1000kbps money"] advertise-interval=5m
/ip hotspot user profile set [/ip hotspot user profile find name="1200kbps money"] advertise-interval=5m
/ip hotspot user profile set [/ip hotspot user profile find name="1500kbps money"] advertise-interval=5m
/ip hotspot user profile set [/ip hotspot user profile find name="1600kbps money"] advertise-interval=5m
/ip hotspot user profile set [/ip hotspot user profile find name="2000kbps money"] advertise-interval=5m	
}
:if ($day = "11") do={
/ip hotspot user profile set [/ip hotspot user profile find name="0400kbps money"] advertise-interval=4m
/ip hotspot user profile set [/ip hotspot user profile find name="0800kbps money"] advertise-interval=4m 
/ip hotspot user profile set [/ip hotspot user profile find name="1000kbps money"] advertise-interval=4m 
/ip hotspot user profile set [/ip hotspot user profile find name="1200kbps money"] advertise-interval=4m 
/ip hotspot user profile set [/ip hotspot user profile find name="1500kbps money"] advertise-interval=4m 
/ip hotspot user profile set [/ip hotspot user profile find name="1600kbps money"] advertise-interval=4m
/ip hotspot user profile set [/ip hotspot user profile find name="2000kbps money"] advertise-interval=4m	 
}
:if ($day = "12") do={
/ip hotspot user profile set [/ip hotspot user profile find name="0400kbps money"] advertise-interval=3m 
/ip hotspot user profile set [/ip hotspot user profile find name="0800kbps money"] advertise-interval=3m 
/ip hotspot user profile set [/ip hotspot user profile find name="1000kbps money"] advertise-interval=3m 
/ip hotspot user profile set [/ip hotspot user profile find name="1200kbps money"] advertise-interval=3m
/ip hotspot user profile set [/ip hotspot user profile find name="1500kbps money"] advertise-interval=3m 
/ip hotspot user profile set [/ip hotspot user profile find name="1600kbps money"] advertise-interval=3m
/ip hotspot user profile set [/ip hotspot user profile find name="2000kbps money"] advertise-interval=3m	 
}
:if ($day = "13") do={
/ip hotspot user profile set [/ip hotspot user profile find name="0400kbps money"] advertise-interval=2m 
/ip hotspot user profile set [/ip hotspot user profile find name="0800kbps money"] advertise-interval=2m
/ip hotspot user profile set [/ip hotspot user profile find name="1000kbps money"] advertise-interval=2m 
/ip hotspot user profile set [/ip hotspot user profile find name="1200kbps money"] advertise-interval=2m
/ip hotspot user profile set [/ip hotspot user profile find name="1500kbps money"] advertise-interval=2m  
/ip hotspot user profile set [/ip hotspot user profile find name="1600kbps money"] advertise-interval=2m
/ip hotspot user profile set [/ip hotspot user profile find name="2000kbps money"] advertise-interval=2m	 
}
:if ($day = "14") do={
/ip hotspot user profile set [/ip hotspot user profile find name="0400kbps money"] advertise-interval=1m 
/ip hotspot user profile set [/ip hotspot user profile find name="0800kbps money"] advertise-interval=1m 
/ip hotspot user profile set [/ip hotspot user profile find name="1000kbps money"] advertise-interval=1m 
/ip hotspot user profile set [/ip hotspot user profile find name="1200kbps money"] advertise-interval=1m 
/ip hotspot user profile set [/ip hotspot user profile find name="1500kbps money"] advertise-interval=1m 
/ip hotspot user profile set [/ip hotspot user profile find name="1600kbps money"] advertise-interval=1m
/ip hotspot user profile set [/ip hotspot user profile find name="2000kbps money"] advertise-interval=1m	 
}
:if ($day = "15") do={
/ip hotspot user disable [/ip hotspot user find profile="to be deleted 0400"]
/ip hotspot user set [/ip hotspot user find profile="0400kbps money"] profile="0400kbps not paid"
/ip hotspot user disable [/ip hotspot user find profile="to be deleted 0800"]
/ip hotspot user set [/ip hotspot user find profile="0800kbps money"] profile="0800kbps not paid"
/ip hotspot user disable [/ip hotspot user find profile="to be deleted 1000"]
/ip hotspot user set [/ip hotspot user find profile="1000kbps money"] profile="1000kbps not paid"
/ip hotspot user disable [/ip hotspot user find profile="to be deleted 1200"]
/ip hotspot user set [/ip hotspot user find profile="1200kbps money"] profile="1200kbps not paid"
/ip hotspot user disable [/ip hotspot user find profile="to be deleted 1500"]
/ip hotspot user set [/ip hotspot user find profile="1500kbps money"] profile="1500kbps not paid"
/ip hotspot user disable [/ip hotspot user find profile="to be deleted 1600"]
/ip hotspot user set [/ip hotspot user find profile="1600kbps money"] profile="1600kbps not paid"
/ip hotspot user disable [/ip hotspot user find profile="to be deleted 2000"]
/ip hotspot user set [/ip hotspot user find profile="2000kbps money"] profile="2000kbps not paid"
}
:if ($day = "20") do={
/ip hotspot user set [/ip hotspot user find where profile="0400kbps not paid"] profile="to be deleted 0400"
/ip hotspot user set [/ip hotspot user find where profile="0800kbps not paid"] profile="to be deleted 0800"
/ip hotspot user set [/ip hotspot user find where profile="1000kbps not paid"] profile="to be deleted 0900"
/ip hotspot user set [/ip hotspot user find where profile="1200kbps not paid"] profile="to be deleted 1200"
/ip hotspot user set [/ip hotspot user find where profile="1500kbps not paid"] profile="to be deleted 1500"
/ip hotspot user set [/ip hotspot user find where profile="1600kbps not paid"] profile="to be deleted 1600"
/ip hotspot user set [/ip hotspot user find where profile="2000kbps not paid"] profile="to be deleted 2000"
/ip hotspot user profile set [/ip hotspot user profile find name="0400kbps money"] advertise-interval=24h advertise-timeout=never
/ip hotspot user profile set [/ip hotspot user profile find name="0800kbps money"] advertise-interval=24h advertise-timeout=never
/ip hotspot user profile set [/ip hotspot user profile find name="1000kbps money"] advertise-interval=24h advertise-timeout=never
/ip hotspot user profile set [/ip hotspot user profile find name="1200kbps money"] advertise-interval=24h advertise-timeout=never
/ip hotspot user profile set [/ip hotspot user profile find name="1500kbps money"] advertise-interval=24h advertise-timeout=never
/ip hotspot user profile set [/ip hotspot user profile find name="1600kbps money"] advertise-interval=24h advertise-timeout=never
/ip hotspot user profile set [/ip hotspot user profile find name="2000kbps money"] advertise-interval=24h advertise-timeout=never
/ip hotspot user set [/ip hotspot user find profile="0400kbps"] profile="0400kbps money"
/ip hotspot user set [/ip hotspot user find profile="0800kbps"] profile="0800kbps money"
/ip hotspot user set [/ip hotspot user find profile="0900kbps"] profile="1000kbps money"
/ip hotspot user set [/ip hotspot user find profile="1200kbps"] profile="1200kbps money"
/ip hotspot user set [/ip hotspot user find profile="1500kbps"] profile="1500kbps money"
/ip hotspot user set [/ip hotspot user find profile="1600kbps"] profile="1600kbps money"
/ip hotspot user set [/ip hotspot user find profile="2000kbps"] profile="2000kbps money"	
}
what's the error in the scrip?
 
User avatar
AnRkey
Member Candidate
Member Candidate
Posts: 118
Joined: Tue Sep 15, 2009 6:01 pm

Re: why this scrip is not working any more?

Fri Sep 28, 2012 12:28 pm

RouterOS 5.30 is not out yet, so do you perhaps mean 5.20?

Have you upgraded RoS and then found that the script stopped working? If so, try switching back to the older RoS.

You can also copy the script, block for block and run it manually in the console. You should see the error pop up when the problem line of code is executed.

Who is online

Users browsing this forum: No registered users and 10 guests