AYcoo
January 19, 2024, 7:44am
1
it was working on v6 no problems i upgraded to v7.13 now it doesn’t work
:local date1 "jan/28/2024";
:local date2 [ /system clock get value-name=date ];
:local months ("jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec");
:local date1month [ :pick $date1 0 3 ];
:local date1day [ :pick $date1 4 6 ];
:local date1year [ :pick $date1 7 11 ];
:local mm ([ :find $months $date1month -1 ] + 1);
:if ($mm < 10) do={
:set date1month ("0" . $mm);
} else={:set date1month $mm;
}
:local date1value ($date1year . $date1month . $date1day);
:local date2month [ :pick $date2 0 3 ];
:local date2day [ :pick $date2 4 6 ];
:local date2year [ :pick $date2 7 11 ];
:local mm ([ :find $months $date2month -1 ] + 1);
:if ($mm < 10) do={
:set date2month ("0" . $mm);
} else={
:set date2month $mm;
}
:local date2value ($date2year . $date2month . $date2day);
if ($date2value >= $date1value) do={
/ip hotspot ip-binding {
:local ui 10.0.0.218
:local uiList [find address=$ui]
:foreach uii in=$uiList do={
set $uii disabled=yes
}
:log error "CL17 has been Disabled"
}}
AYcoo
January 19, 2024, 8:01am
3
ty for replying so ineed to downgrade to 7.8 or 7.9 for it to get it work
AYcoo
January 19, 2024, 10:44am
4
still get same result after downgrading to 7.9.2 !!
:local date1 "feb/18/2024";
:local date2 [ /system clock get value-name=date ];
:local months ("jan","feb","mar","apr","may","jun","jul","aug","sep
","oct","nov","dec");
:local date1month [ :pick $date1 0 3 ];
:local date1day [ :pick $date1 4 6 ];
:local date1year [ :pick $date1 7 11 ];
:local mm ([ :find $months $date1month -1 ] + 1);
:if ($mm < 10) do={
{... :set date1month ("0" . $mm);
syntax error (line 2 column 6)
} else={:set date1month $mm;
}
:local date1value ($date1year . $date1month . $date1day);
:local date2month [ :pick $date2 0 3 ];
:local date2day [ :pick $date2 4 6 ];
:local date2year [ :pick $date2 7 11 ];
:local mm ([ :find $months $date2month -1 ] + 1);
:if ($mm < 10) do={
{... :set date2month ("0" . $mm);
syntax error (line 2 column 10)
} else={
:set date2month $mm;
syntax error (line 1 column 10)
}
:local date2value ($date2year . $date2month . $date2day);
if ($date2value >= $date1value) do={
{... /ip hotspot ip-binding {
{{... :local ui 10.0.0.95
{{... :local uiList [find address=$ui]
{{... :foreach uii in=$uiList do={
{{{... set $uii disabled=yes
{{{... }
{{... :log error "CL67 has been Disabled"
{{... }}
If you want test the script on terminal, you must put all the script between { }
else each line is treated as single script, and you give errors.
And when you paste terminal output, do not use “code”, is not one scipt, and do not remove prompt…
[rex@do-not-remove-prompt] > :local date1 “jan/28/2024”;
[rex@do-not-remove-prompt] >
[rex@do-not-remove-prompt] > :local date2 [ /system clock get value-name=date ];
[rex@do-not-remove-prompt] >
[rex@do-not-remove-prompt] > :local months (“jan”,“feb”,“mar”,“apr”,“may”,“jun”,“jul”,“aug”,“sep”,“oct”,“nov”,“dec”);
[rex@do-not-remove-prompt] >
[rex@do-not-remove-prompt] > :local date1month [ :pick $date1 0 3 ];
[rex@do-not-remove-prompt] > :local date1day [ :pick $date1 4 6 ];
[rex@do-not-remove-prompt] > :local date1year [ :pick $date1 7 11 ];
[rex@do-not-remove-prompt] > :local mm ([ :find $months $date1month -1 ] + 1);
[rex@do-not-remove-prompt] > :if ($mm < 10) do={
{… :set date1month (“0” . $mm);
syntax error (line 2 column 6) variable date1mont undefined [rex@do-not-remove-prompt] > } else={:set date1month $mm;
[rex@do-not-remove-prompt] > }
[rex@do-not-remove-prompt] > :local date1value ($date1year . $date1month . $date1day);
[rex@do-not-remove-prompt] >
[rex@do-not-remove-prompt] >
[rex@do-not-remove-prompt] >
[rex@do-not-remove-prompt] > :local date2month [ :pick $date2 0 3 ];
[rex@do-not-remove-prompt] > :local date2day [ :pick $date2 4 6 ];
[rex@do-not-remove-prompt] > :local date2year [ :pick $date2 7 11 ];
[rex@do-not-remove-prompt] > :local mm ([ :find $months $date2month -1 ] + 1);
[rex@do-not-remove-prompt] > :if ($mm < 10) do={
{… :set date2month (“0” . $mm);
syntax error (line 2 column 10) variable date2month undefined [rex@do-not-remove-prompt] > } else={
[rex@do-not-remove-prompt] > :set date2month $mm;
syntax error (line 1 column 10) variable date2month undefined [rex@do-not-remove-prompt] > }
[rex@do-not-remove-prompt] >
[rex@do-not-remove-prompt] > :local date2value ($date2year . $date2month . $date2day);
[rex@do-not-remove-prompt] > if ($date2value >= $date1value) do={
{… /ip hotspot ip-binding {
syntax error (line 2 column 24) package hotspot not found [rex@do-not-remove-prompt] > :local ui 10.0.0.218
[rex@do-not-remove-prompt] > :local uiList [find address=$ui]
expected end of command (line 1 column 28) parameter addres unexpected on root :find [rex@do-not-remove-prompt] > :foreach uii in=$uiList do={
{… set $uii disabled=yes
expected end of command (line 2 column 18) parameter disabled unexpected on root :set [rex@do-not-remove-prompt] > }
[rex@do-not-remove-prompt] > :log error “CL17 has been Disabled”
[rex@do-not-remove-prompt] > }}
AYcoo
January 19, 2024, 11:13am
6
so there is no fixing for the script on v7.13
Someone must rewrite the script, near from scratch.
Or probably the script is useless, given how it is written and from the little we understand what it is for,
just program this line below every 28th of the month at 23:59…
/ip hotspot ip-binding set [find where address=10.0.0.95] disabled=yes ; :log error "CL67 has been Disabled"
AYcoo
January 19, 2024, 11:21am
9
can you help with that please
AYcoo
January 19, 2024, 11:24am
11
im using this script with app so it must do this and check for the date if user still on subscription date or not if no it disabled
Do you have a script for each user, and in each one you change the date, name and IP??
AYcoo
January 19, 2024, 11:29am
13
Please remove quote on previous post.
Do you have a script for each user, and in each one you change the date, name and IP??
yes on scheduler it check every day if user subscription still valid or not
Write a detailed description, and maybe some volunteer will rewrite it for you.
But until it is perfectly clear how it is used, and where it is written,
based only on what you have written so far, the logical conclusion is what I wrote on previous post…
Instead of modify everytime the date inside the script, change the date of the scheduler when the line must run…