Auto Delete User Script

can anyone help me to edit or create some script that auto delete a hotspot user that isn’t logged-in/used for 1 week?

this is my current script for the userprofile
IP>hotspot>user profiles>user profile(example)>scripts>on Login

{
:local voucher $user;
:if ([/system scheduler find name=$voucher]="") do={/system scheduler add comment=$voucher name=$voucher interval=2d on-event="/ip hotspot active remove [find user=$voucher]\r\n/ip hotspot user remove [find name=$voucher]\r\n/system schedule remove [find name=$voucher]"}
}

current script only automatically remove hotspot user when it ran out of time or did get used but didn’t finished his time.

You could create a global variable linked to the $user with the creation date.

A two field array would do.

Problem with RouterOS is that it does not follow any standard time format. I have made a script that convert date/time to epoc that can be used to calculate time difference. This is some that MT should add as a standard.

exactly >.>

What was the question again?

need a script that

  1. Auto delete hotspot users that’s unused (not logged in) for 1 week or 7 days.
  2. The script will only work on unused hotspot users.
  3. The auto delete hotspot user script will stop and proceed to the current script that deletes the hotspot user when the hotspot user maxed out his uptime or auto deletes the hotspot user 2 days from the date and time he logged in regardless of his uptime remaining.

is it possible in mikrotik to do that?

Yes it is possible…for User that will be deleted a certain time used or unused > User Profile > On Login "schedule the user upon First Log-in, to be check at a certain time (7 days) interval, and will remove the user at hotspot user and hotspot active, and last will delete the user schedule.
while for the timed up users create schedule that will check users every X interval if the uptime is equal to limit-uptime, and if true remove user in hotspot user.
I use this method on my Vifi Wifi Vendo routine.

ok nvm, solved my problem. I just made my Arduino not only generate hotspot user but also make a schedule for that hotspot user.
then when logged in, proceed to delete the schedule for the hotspot user that is tied being used and proceed to the standard script I’ve posted.