SSH OnFileUploaded and SSH OnFileDownLoaded
Posted: Fri Sep 13, 2013 3:35 pm
I want to trigger a LOG when UpLOaded each File by SSH. This is my code:
math.randomseed(os.time())
n = math.random(123456789, 987654321)
-- Generation of ZFILE ZS
if "%Name" ~= "super_user_tdx_esftp" then
local username = "%Name"
local sessionid = "%ConnectID"
local tempfilepath = "C:/" .. "TRADEXPRESS" .. "/" .. username .. "/" .. "ZS" .. n .. username .. sessionid
local f = io.open(tempfilepath , "a")
--
f:write("USERNAME=")
f:write("%Name")
f:write("\n")
--
f:write("LOGNAME=")
f:write(string.sub("%Name",1,string.find("%Name","_") - 1))
f:write("\n")
--
f:write("SUBNAME=")
f:write(string.sub("%Name",string.find("%Name","_") + 1))
f:write("\n")
--
f:write("ACCOUNT=")
f:write("")
f:write("\n")
--
f:write("REMOTE_HOSTNAME=")
f:write("%ClientVersion")
f:write("\n")
--
f:write("REMOTE_HOSTADDR=")
f:write("%IP")
f:write("\n")
--
f:write("REMOTE_LOGNAME=")
f:write("unknown")
f:write("\n")
--
f:write("DIRECTION=")
f:write("S")
f:write("\n")
--
f:write("TRANSFER=")
f:write("STOR")
f:write("\n")
--
f:write("ZFILE=")
f:write(tempfilepath)
f:write("\n")
--
f:write("DATAFILE=")
f:write("%PathName")
f:write("\n")
--
f:write("STATUS=")
f:write("OK")
f:write("\n")
--
f:write("#EOF")
f:write("\n")
f:close()
end
But the problem is that when a client UpLoad more than one file at the same time, i have only one LOG file created, so , I want that when a client UpLoad more than one file at the same time, each file has his own LOG File!!!
Please I wait for your answers
Your Welcome.
math.randomseed(os.time())
n = math.random(123456789, 987654321)
-- Generation of ZFILE ZS
if "%Name" ~= "super_user_tdx_esftp" then
local username = "%Name"
local sessionid = "%ConnectID"
local tempfilepath = "C:/" .. "TRADEXPRESS" .. "/" .. username .. "/" .. "ZS" .. n .. username .. sessionid
local f = io.open(tempfilepath , "a")
--
f:write("USERNAME=")
f:write("%Name")
f:write("\n")
--
f:write("LOGNAME=")
f:write(string.sub("%Name",1,string.find("%Name","_") - 1))
f:write("\n")
--
f:write("SUBNAME=")
f:write(string.sub("%Name",string.find("%Name","_") + 1))
f:write("\n")
--
f:write("ACCOUNT=")
f:write("")
f:write("\n")
--
f:write("REMOTE_HOSTNAME=")
f:write("%ClientVersion")
f:write("\n")
--
f:write("REMOTE_HOSTADDR=")
f:write("%IP")
f:write("\n")
--
f:write("REMOTE_LOGNAME=")
f:write("unknown")
f:write("\n")
--
f:write("DIRECTION=")
f:write("S")
f:write("\n")
--
f:write("TRANSFER=")
f:write("STOR")
f:write("\n")
--
f:write("ZFILE=")
f:write(tempfilepath)
f:write("\n")
--
f:write("DATAFILE=")
f:write("%PathName")
f:write("\n")
--
f:write("STATUS=")
f:write("OK")
f:write("\n")
--
f:write("#EOF")
f:write("\n")
f:close()
end
But the problem is that when a client UpLoad more than one file at the same time, i have only one LOG file created, so , I want that when a client UpLoad more than one file at the same time, each file has his own LOG File!!!
Please I wait for your answers
Your Welcome.