LUA Script for Logins older than 180 Days

You can share your Lua Scripts with everybody here.

LUA Script for Logins older than 180 Days

Postby neefstumme » Mon Sep 12, 2016 12:39 pm

Hallo,

I'm looking for a script to me all users within a group whose access more than 180 days old is outputting . The result I would then send them by mail . Is such a thing possible ?
neefstumme
 
2
 
Fri Jun 26, 2015 8:18 am

Re: LUA Script for Logins older than 180 Days

Postby FTP » Tue Sep 13, 2016 8:07 am

Code: Select all
do
   local domain = "demo"
   local strUserlist = c_GetUserList(domain)
   local userlist = Split(strUserlist, "\n")

   for _,username in pairs(userlist) do
      local user = c_GetUser(domain, username)
      local logintime = user.last_logintime
      local logintime_t = c_TranslateTime(logintime)
      if (os.time() - logintime_t) >= 3600*24*180 then
         local userEmail = user.note_email
         c_SendMail(userEmail,"FTP Account Expiration Alert","Dear FTP user,\r\n\r\n Your FTP account will be expired soon, please login the FTP server as soon as possible!","","SMTP_CONFIG")
      end
   end

end



Here, "SMTP_CONFIG" is your SMTP configuration name under "Servers -> Settings -> SMTP Manager".
And, you also need to define the user email address at "Edit User -> Notes -> Email address".
FTP
Site Admin
 
1876
 
Tue Sep 29, 2009 6:09 am

Re: LUA Script for Logins older than 180 Days

Postby neefstumme » Thu Sep 15, 2016 9:50 am

Hallo,

thanks for posting. Works great, but I only want this for a Group of Users from a Domain.
neefstumme
 
2
 
Fri Jun 26, 2015 8:18 am

Re: LUA Script for Logins older than 180 Days

Postby vitokk » Fri Jan 19, 2018 6:02 am

Hi, Is it possible to display a list of users who have not logged in for 180 days? Not send them info but show on screen or save to file.
vitokk
 
2
 
Fri Jan 19, 2018 6:00 am


Return to Lua scripts

Who is online

Users browsing this forum: No registered users and 2 guests