Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with mikrotik default UTC on User Profile "On Login" Script #28

Open
ericmg97 opened this issue Dec 21, 2020 · 1 comment
Open

Comments

@ericmg97
Copy link

Mikrotik by default, works on UTC 00:00 but if you live on another UTC, lets say UTC - 05:00 as example, when you have a user profile that expires in 1 day, then the users of that user profile that try to login for the first time between 19:00:00 and 23:59:59 will be marked as expired as soon as they logged in because when you run your script on login for that user profile, you ask for the next-run of the scheduler with 1d of delay created before, but mikrotik in this case will give only the time, instead of date and time by error, because to them it's the same date since they use UTC 00:00

/sys sch add name="$user" disable=no interval="1d";
:delay 2s;
:local exp [ /sys sch get [ /sys sch find where name="$user" ] next-run]; 
:local getxp [len $exp];

On the example getexp will take 8 as value by mikrotik error and then you choose the current date as the expiration date:

:if ($getxp = 8) do={ /ip hotspot user set comment="$date $exp" [find where name="$user"];};

When the scheduler for that user profile is triggered it marks the user as expired exactly at the same time of their first connection.

@LUISVMAN
Copy link

THEY CAN TRY TO CONFIGURE THE MIKROTIK WITH UTC gmt-offset: +00: 00

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants