0% found this document useful (0 votes)
211 views1 page

Auto Delete Hotspot Users Script

This document contains three versions of scripts for automatically removing Mikrotik hotspot users. Version 1 sets a user comment if empty and adds a script to remove the user and related entities after a set time interval. Version 2 adds user profiles for blocking or removing a user after the interval. Version 3 adds a scheduler to automatically delete users after a set duration. It also provides an explanation of the scheduler settings. The last part shows how to delete users when their quota is exceeded based on bytes in, out or total.

Uploaded by

Anto Hartanto
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
211 views1 page

Auto Delete Hotspot Users Script

This document contains three versions of scripts for automatically removing Mikrotik hotspot users. Version 1 sets a user comment if empty and adds a script to remove the user and related entities after a set time interval. Version 2 adds user profiles for blocking or removing a user after the interval. Version 3 adds a scheduler to automatically delete users after a set duration. It also provides an explanation of the scheduler settings. The last part shows how to delete users when their quota is exceeded based on bytes in, out or total.

Uploaded by

Anto Hartanto
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

VERSI 1

:local date [/system clock get date];


:local time [/system clock get time];
:log info "";
{
:if ( [ /ip hotspot user get $user comment ] = "" ) do={
[ /ip hotspot user set $user comment=$user]
}
}
/system script add name=$user policy=read,write source="/ip hotspot user remove
[find comment=$user]\r\nip hotspot active remove [/ip hotspot active find
user=$user]\r\nsystem scheduler remove $user\r\nsystem script remove $user"
system scheduler add name=$user start-time="$time" interval=1d policy=read,write
on-event=$user

VERSI 2
DI ISI DI USER PROFIL
/system scheduler add name="remove-user-$user"interval=1d on-even="/ip hotspot
active remove [find user=$user] ; /ip hotspot user set$user profil=BLOKIR; system
scheduler remove [find name=remove-user-$user]"
DI ISI DI PROFIL BLOKIR
/system scheduler add name="remove-blokir-$user"interval=1d on-even="/ip hotspot
active remove [find user=$user] ; /ip hotspot user remove [find name=$user]; system
scheduler remove [find name=remove-blokir-$user]"

VERSI 3 RIFAI UCIHA


AUTO DELETE USER HOTSPOT By DURATION
*******************************************
local a $user
if ([len [/system scheduler find name=$a]] = 0) do={[
/system scheduler add name=$a interval="30d 00:00:00" start-time="03:00:00" on-
event="if ([len [/ip hotspot user find name=$a]] = 1) do={[/ip hotspot user remove
[find name=$a]]}
/system scheduler remove [find name=$a]"
]}

PENJELASAN:
interval: sesuaikan berapa lama scheduler tersebut di jalankan. sebagai contoh 30d
00:00:00 yg artinya 30 hari
start-time: jam berapa scheduler di jalankan, sebagai contoh 03:00:00 yg artinya di
jalankan jam 3 pagi

AUTO DELETE USER HOTSPOT By QUOTA


*******************************************
/ip hotspot user remove [find profile="Pembeli-1Gb" bytes-in>1073740000]
/ip hotspot user remove [find profile="Pembeli-1Gb" bytes-out>1073740000]
/ip hotspot user remove [find profile="Pembeli-1Gb" bytes-total>1073740000]

PENJELASAN:
profile: akan mencari seluruh user yang nama profile nya Pembeli-1Gb
bytes-in: akan menghapus user yang byte-in nya lebih besar dari 1073740000
bytes-out: akan menghapus user yang byte-out nya lebih besar dari 1073740000
bytes-total: akan menghapus user yang byte-total nya lebih besar dari 1073740000
Silahkan sesuaikan dengan pengaturan hotspot mikrotik kalian, agar lebih jelas
silahkan simak videonya.
[Link]

Common questions

Powered by AI

Scripting and scheduling enhance security by automating user management, reducing human error and preventing unauthorized access by promptly removing inactive or high-risk users. This also ensures compliance with data policies by managing access based on predefined data usage limits .

To adapt to growing demands, the system could employ more granular profiling and dynamic scheduler adjustments based on real-time data analytics. Enhancements might include machine learning algorithms for predictive management, scalable infrastructure to handle increased loads, and variable data policies to optimize resource use .

Scripts enable automated management of user accounts by defining tasks such as removing users based on criteria like time duration or data usage. This reduces manual tasks and potential errors, providing a systematic approach to resource allocation and freeing administrators to focus on other critical tasks .

Choosing different time intervals impacts network performance by determining how frequently tasks are performed. Short intervals for removal or updates can lead to regular system checks, maintaining optimal performance. However, excessively frequent intervals might use resources inefficiently, while overly extended intervals could delay necessary updates, affecting user experience negatively .

User profiling enables the system to apply different management strategies based on user needs and behavior, such as setting data limits or durations specific to each profile. This tailored approach maximizes network efficiency and ensures users receive appropriate resources, enhancing overall service quality .

Setting a start-time ensures that tasks, such as user deletion or quota checks, are performed during periods of low network usage, minimizing disruption. It balances resource utilization and operational effectiveness by scheduling at strategic times, like early morning, when user activity is low .

Automated deletion improves efficiency by ensuring timely removal of inactive users, freeing resources. However, potential drawbacks include unintended deletion if criteria are not precisely defined or errors in script execution, which can lead to service disruptions or user dissatisfaction if not properly managed .

The scheduler is used to automate tasks for managing hotspot users, such as removing them after a certain duration or when data limits are exceeded. This ensures dynamic and efficient management without manual intervention, enhances resource utilization, and maintains network performance .

The system continuously checks for users whose data usage exceeds a predefined limit (1Gb in this case). It uses removal commands based on the parameters bytes-in, bytes-out, and bytes-total for the specified profile, 'Pembeli-1Gb'. If any of these exceed 1073740000 bytes, the user is automatically removed .

On-event scripts are crucial for proactive management by enabling real-time response to network conditions. They allow for immediate actions like disconnections or reassignments when specific criteria are met, preventing system overloads and enhancing user experience through timely adjustments .

You might also like