Community discussions

MikroTik App

Search found 8 matches

by MLR
Sat Mar 16, 2024 3:10 am
Forum: Scripting
Topic: delete address list old than 7 days
Replies: 26
Views: 11032

Re: delete address list old than 7 days

RouterOS 7.10.+ use Date on ISO format, so something like " /ip firewall address-list remove [find where (creation-time< $daysago and list= $theList )] " work without use any clycle and is faster. Just calc $daysago 30 days less than "today" pseudocode, if RouterOS have such fun...
by MLR
Sun Oct 29, 2023 7:17 pm
Forum: Scripting
Topic: delete address list old than 7 days
Replies: 26
Views: 11032

Re: delete address list old than 7 days

delete exactly 30 days old address list values. :global datetime2epoch do={ :local dtime [:tostr $1] /system clock :local cyear [get date] ; :if ($cyear ~ "....-..-..") do={:set cyear [:pick $cyear 0 4]} else={:set cyear [:pick $cyear 7 11]} :if (([:len $dtime] = 10) or ([:len $dtime] = 11...
by MLR
Sun Oct 29, 2023 3:50 pm
Forum: Scripting
Topic: script to calculate next date [SOLVED]
Replies: 16
Views: 15617

Re: script to calculate next date [SOLVED]

:global datetime2epoch do={ :local dtime [:tostr $1] /system clock :local cyear [get date] ; :if ($cyear ~ "....-..-..") do={:set cyear [:pick $cyear 0 4]} else={:set cyear [:pick $cyear 7 11]} :if (([:len $dtime] = 10) or ([:len $dtime] = 11)) do={:set dtime "$dtime 00:00:00"} ...
by MLR
Sun Oct 29, 2023 3:35 pm
Forum: General
Topic: ⚠️WARNING: RouterOS v7.10+ will break all scripts based on [/system clock get date] or other date(s)
Replies: 66
Views: 16112

Re: ⚠️WARNING: RouterOS v7.10+ will break all scripts based on [/system clock get date] or other date(s)

if you don't mind, can you review above code & fix it for me. please @rextended
viewtopic.php?t=127050#p1032727
Thanks i removed all previous code & moved to your one. works very well. Thank you again
by MLR
Sat Oct 28, 2023 6:25 pm
Forum: Scripting
Topic: script to calculate next date [SOLVED]
Replies: 16
Views: 15617

Re: script to calculate next date [SOLVED]

please update the script suitable to 7.10 OS update. Please
by MLR
Sat Oct 28, 2023 6:14 pm
Forum: General
Topic: ⚠️WARNING: RouterOS v7.10+ will break all scripts based on [/system clock get date] or other date(s)
Replies: 66
Views: 16112

Re: ⚠️WARNING: RouterOS v7.10+ will break all scripts based on [/system clock get date] or other date(s)

i was able to get yesterday date using following script.but recent updates killed it. Can anyone fix this for me func_date ################################################################### func_shiftDate - add days to date # Input: date, days # date - "jan/1/2017" # days - number, +/- ##...
by MLR
Tue Oct 17, 2023 10:21 am
Forum: Scripting
Topic: delete address list old than 7 days
Replies: 26
Views: 11032

Re: delete address list old than 7 days

Is there anyone can build this script. i also want similar script that need to delete address list old than 60 days. I can't use dynamic IP timeout settings due to power failures.