Community discussions

MikroTik App
 
tiftok
newbie
Topic Author
Posts: 49
Joined: Thu Apr 07, 2016 1:40 pm

remove user have a transfer limit and Validity not end from user manager in mikirotik

Thu Mar 04, 2021 2:52 pm

this script do :
remove user have a transfer limit and Validity not end from user manager in mikirotik and save log to file
please make backup from your user manager database frist
script :
  create script tiftokremove
  قم بانشاء الاسكربت باسم tiftokremove
  please make backup for your db frist 
 {
 ##dev : tiftok.com  khaled almalsi https://www.youtube.com/c/TIFTOK
 ## this script is free 100%
  ## {"profilename1";"profilename2"}
 :local profilename { "P500M";"P1G"};   
 
 
  ## {profilelimit1;profilelimit2}
 
 :local profilelimit { 512 ;1024};

  :delay 5s;
 
: local contentss "" ;


: set contentss ($contentss."<html> <head></head><body>") ;
 :for O from=0 to=([:len $profilename]-1) step=1 do={
  
  :foreach i in [/tool user-manager user find where actual-profile=($profilename->$O)] do={
  :local upload
  :set upload [/tool user-manager user get $i upload-used]
  :local download
  :set download [/tool user-manager user get $i download-used]
    :global cardusername
  :set cardusername [/tool user-manager user get $i user]
  :local total ((($upload+$download)/1024)/1024) ;
   :set upload ((($upload)/1024)/1024)
   :set download ((($download)/1024)/1024)
if ($total=($profilelimit->$O)) do={
   :local newdata  "the user is $cardusername upload is $upload and download is $download  total is $total" ;
 : set  contentss ($contentss ."<br />". $newdata) 
   [/tool user-manager user remove $i]
}
 
  
}
 
}
  : set  contentss ($contentss ."</body></html>") 

:put [$contentss]

}


 {
  :local date [/system clock get date]
:local time [/system clock get time]
:local filec ("removelogstat-".[:pick $date 7 11]."-".[:pick $date 0 3]."-".[:pick $date 4 6]."-".[:pick $time 0 2].[:pick $time 3 5].".html")
:local script2write  [/system script  get [/system script find where name=tiftokremove] source ]

  :execute script=$script2write file=$filec
}

how to work in arabic :
https://www.youtube.com/watch?v=FVAcnAAnbXc

how to work in english :
https://www.youtube.com/watch?v=6KJ-WvKLV24

Who is online

Users browsing this forum: johannwill and 4 guests