Kick all sessions having "Keep alive"

You can share your Lua Scripts with everybody here.
Post Reply
Broemmelhaus
Posts: 12
Joined: Tue Nov 29, 2011 12:00 pm
Location: Bonn, Germany

Kick all sessions having "Keep alive"

Post by Broemmelhaus »

Hello,

I try to Kick all Sessions having "Keep_Alive" as last remark.
The Little Lua-script works very well.

Here's my script:
local strUserlist = {}
strUserlist = c_GetConnectionsList("Domain")
for nr in pairs(strUserlist) do
local letztes = strUserlist[nr].lastcommand
local user = strUserlist[nr].username
if string.find(letztes, 'KEEP ALIVE') then
c_KickSession('Domain',strUserlist[nr].id,0,0,0,0,0,0)
end
end

But I recognized, that WingFTP remarks "Keep alive" for users who's uploads are in still in progress. So the script kicks sessions that shouldn't be "kicked".
Now I tried to use "%ConTransferByte" but I got no values back from the System.

Perhaps someone can help to solve my problem, getting the information, if there is any process (upload/download) in progress.

Thx
Meik
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: Kick all sessions having "Keep alive"

Post by FTP »

For your requirement, you can solve it via a simple method, just modify the file "webclient/main.html", remove the following line:

_TIMER_KEEPLIVE = setInterval("keeplive()",1000*300);
Broemmelhaus
Posts: 12
Joined: Tue Nov 29, 2011 12:00 pm
Location: Bonn, Germany

Re: Kick all sessions having "Keep alive"

Post by Broemmelhaus »

Thx FTP for the really simple method!

But if I understand it right, this one line will not solve my problem, if there is an upload/download in process. The logs last entry is a "Keep alive" and the up-/download is still running. These sessions shouldn't be kicked off.

Is ist possible to manage?

Or does the remove of "_TIMER_KEEPLIVE = setInterval("keeplive()",1000*300);" solve this too?

Best regards
Meik
Post Reply