Wanted to limit my kids to 30 min sessions with a max of 1.5hrs a day.
Used one script/user profile per user, triggered at login, and one script/schedule to reset values each day at midnight.
Would like to be able to get username value to allow a single profile/script. Any suggestions?
Also had to use a timer system based on user uptime-limit + 10 sec delay, because I was unable to figure out a good way to trigger the script when user is logged off due to session time. Help??
Well Here it is,
This is specific to known user names Hotspot user assigned to indivigual user profile. Profile script at log-on triggers.
Code: Select all
:global maggieCount; #Tracks of num resets;
{
:local uptime;
:local limit;
:local overLimit;
:set overLimit 0;
:set limit [/ip hotspot user get Maggie limit-uptime];
:delay $limit;
:delay 10s;
:set uptime [/ip hotspot user get Maggie uptime];
:if ($uptime>=$limit) do={:set overLimit 1};
:if ($overLimit = 1) do={:set maggieCount ($maggieCount + 1);
:if ($maggieCount<=3) do={ [ /ip hotspot user reset-counters ("Maggie")];
:log info "Maggies uptime was reset."} else={:log info "Maggies uptime was not reset."};}
:log info " Maggies reset count is $maggieCount."};
}
This resets count values, triggered by scheduler.
Code: Select all
:global maggieCount
:global sarahCount
:set sarahCount 0
:set maggieCount 0
Works But would love improvement ideas.
Thanks
LeRoy