Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # pertama, buat on login script untuk profile 1jam, 2jam, 3jam, 1gb dimana saat login akan cek apakah sudah ada parent 1MBPS, bila belum dibuatlah parent 1MBPS tersebut sekaligus membuat childnya :
- # on login script user profile 1jam-expired-1hari :
- {
- :local usernya $user;
- :local ipnya $address;
- :if ([/queue simple find name=1MPBS]="") do={
- /queue simple add name=1MBPS target=172.16.16.0/22 max-limit=1M/1M limit-at=1M/1M queue=default/default
- /queue simple add name="$usernya$ipnya" parent=1MBPS target=$ipnya max-limit=1M/1M limit-at=1k/1k queue=default/default
- } else={
- /queue simple add name="$usernya$ipnya" parent=1MBPS target=$ipnya max-limit=1M/1M limit-at=1k/1k queue=default/default
- }
- :if ([/ip hotspot user find name=$usernya limit-uptime=1h]="") do={/ip hotspot user set [find name=$usernya] limit-uptime=1h};
- :if ([/system schedule find name=$usernya]="") do={
- /system schedule add name=$usernya interval=1d on-event="/ip hotspot user remove [find name=$usernya]\r\n/ip hotspot active remove [find user=$usernya]\r\n/system schedule remove [find name=$usernya]"
- }
- }
- # on logout script user profile 1jam-expired-1hari
- {
- :local usernya $user;
- :local ipnya $address;
- /queue simple remove [find name="$usernya$ipnya"];
- :if ([/queue simple find parent=1MBPS]="") do={/queue simple remove [find name=1MBPS]}
- }
- ### lakukan hal yang sama untuk time-based 2jam,3jam,harian,mingguan dan bulanan, sesuaikan parent,limit-uptime dan interval ###
- # on login script user profile 1gb-expired-1hari :
- {
- :local usernya $user;
- :local ipnya $address;
- :if ([/queue simple find name=1MBPS]="") do={
- /queue simple add name=1MBPS target=172.16.16.0/22 max-limit=1M/1M limit-at=1M/1M queue=default/default
- /queue simple add name="$usernya$ipnya" parent=1MBPS target=$ipnya max-limit=1M/1M limit-at=1k/1k queue=default/default
- } else={
- /queue simple add name="$usernya$ipnya" parent=1MBPS target=$ipnya max-limit=1M/1M limit-at=1k/1k queue=default/default
- }
- :if ([/ip hotspot user find name=$usernya limit-bytes-total=1073741824]="") do={/ip hotspot user set [find name=$usernya] limit-bytes-total=1073741824};
- :if ([/system schedule find name=$usernya]="") do={
- /system schedule add name=$usernya interval=1d on-event="/ip hotspot user remove [find name=$usernya]\r\n/ip hotspot active remove [find user=$usernya]\r\n/system schedule remove [find name=$usernya]"
- }
- }
- # on logout script user profile 1gb-expired-1hari
- {
- :local usernya $user;
- :local ipnya $address;
- /queue simple remove [find name="$usernya$ipnya"];
- :if ([/queue simple find parent=1MBPS]="") do={/queue simple remove [find name=1MBPS]}
- }
- ### lakukan hal yang sama untuk volume-based 10gb dan 100gb, sesuaikan parent,limit-bytes-total dan interval ###
- # system schedule saat mikrotik nyala/startup agar terhapus semua queue simple yang masih tertinggal bila user tidak logout kemudian terjadi pemadaman listrik atau mirkotik reboot atau mirkotik shutdown #
- - buat system scheduler , namai delete-queue-user
- - start-time = startup
- - interval = 0
- - on event script :
- /queue simple remove [find name=1MBPS]
- /queue simple remove [find name=3MBPS]
- /queue simple remove [find name=10MBPS]
- /queue simple remove [find name=PRIVATE]
Add Comment
Please, Sign In to add comment