Hello, how are you
I hope everyone is well
I have a script
Working on issuing
v6
I updated to the latest version v7
It no longer works
global input [/system clock get date]
:global mon 0
:if ([:len $input] > 0) do={
:local input1 [ [:pick $input 0 3]]
#/log info " $input1 "
:local months [:toarray “jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec”]
:for x from=0 to=([:len $months] -1 ) do={
:if ([:tostr [:pick $months $x]] = [:tostr [:pick $input1 0 3]]) do={
:if ($x <= 9) do={ :set mon (($x + 1))} else={ :set mon ($x + 1) } } }
/log info [ [:pick $input 4 6]]
#/log info “$mon”
}
:global xxx ($mon.“/”.[:pick $input 4 6].“/”.[:pick $input 7 11])
/log info “$xxx”
/ppp secret
:foreach i in=[find] do={
:local name1 [get $i name]
:local name [get $i routes]
:if ($xxx=$name) do={
/ppp secret disable [/ppp secret find name=$name1]
/ppp active remove [find name=$name1] }
}
Can you modify it to make it work?
New version v7
xrlls
September 11, 2024, 8:15pm
2
The date format was updated in ROS7.10, and your code needs to be updated accordingly.
Check e.g. this thread for more info: http://forum.mikrotik.com/t/warning-routeros-v7-10-will-break-all-scripts-based-on-system-clock-get-date-or-other-date-s/166576/1
I think this will do it for you:
:global input [/system clock get date]
:global xxx ([:pick $input 5 7]."/".[:pick $input 8 10]."/".[:pick $input -1 4])
/log info "$xxx"
/ppp secret
:foreach i in=[find] do={
:local name1 [get $i name]
:local name [get $i routes]
:if ($xxx=$name) do={
/ppp secret disable [/ppp secret find name=$name1]
/ppp active remove [find name=$name1] }
}
No guarantees…
Didn’t work for me
Is it possible for me to write?
Date format
in
routes. routes
The date format was updated in ROS7.10, and your code needs to be updated accordingly.
Check e.g. this thread for more info: http://forum.mikrotik.com/t/warning-routeros-v7-10-will-break-all-scripts-based-on-system-clock-get-date-or-other-date-s/166576/1
I think this will do it for you:
:global input [/system clock get date]
:global xxx ([:pick $input 5 7]."/".[:pick $input 8 10]."/".[:pick $input -1 4])
/log info "$xxx"
/ppp secret
:foreach i in=[find] do={
:local name1 [get $i name]
:local name [get $i routes]
:if ($xxx=$name) do={
/ppp secret disable [/ppp secret find name=$name1]
/ppp active remove [find name=$name1] }
}
No guarantees…
xrlls
September 13, 2024, 11:20am
4
You are not exactly clear on the purpose of the script, but in this line:
:if ($xxx=$name) do={
It seems that you are comparing a date to a route. I cant imagine that will ever be true.
Maybe you should be comparing to name1 instead, if the name of the secret is a date?
In this case it would be:
:global input [/system clock get date]
:global xxx ([:pick $input 5 7]."/".[:pick $input 8 10]."/".[:pick $input -1 4])
:put $xxx
/log info "$xxx"
/ppp secret
:foreach i in=[find] do={
:local name1 [get $i name]
:local name [get $i routes]
:if ($xxx=$name1) do={
/ppp secret disable [/ppp secret find name=$name1]
/ppp active remove [find name=$name1]
}
}
@xrlls :
The field “routes” is used just as text filed with the date
The existing user still have old “routes” date style written, so the new do not match.
Also the script (if not doed by hand) that set the date inside the routes field is broken.
If you notice, I don’t respond to incomplete and approximate requests for help like this, even though I read them anyway, or a topic with this ridiculous title…
If you want to help always ask for the complete scripts, and assume that if there is something that reads, there is also something that writes it first…