Page 1 of 1
LUA Script for Logins older than 180 Days
Posted: Mon Sep 12, 2016 12:39 pm
by neefstumme
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 ?
Re: LUA Script for Logins older than 180 Days
Posted: Tue Sep 13, 2016 8:07 am
by FTP
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".
Re: LUA Script for Logins older than 180 Days
Posted: Thu Sep 15, 2016 9:50 am
by neefstumme
Hallo,
thanks for posting. Works great, but I only want this for a Group of Users from a Domain.
Re: LUA Script for Logins older than 180 Days
Posted: Fri Jan 19, 2018 6:02 am
by vitokk
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.