Daily scheduler task for removing inactive users

You can share your Lua Scripts with everybody here.

Daily scheduler task for removing inactive users

Postby FTP » Mon Oct 19, 2009 1:11 pm

-- Description: daily scheduler task for removing inactive users that have not logged in within 15 days
-- Author: Luke
-- Date: 2009-10-12

Code: Select all
do
   --Get user list from domain "demo"
   local strUserlist = c_GetUserList("demo")
   local userlist = Split(strUserlist,"\n")

   for _,username in pairs(userlist) do
      local user = c_GetUser("demo",username)
      local logintime = user.last_logintime
      --get last login time, formatted as time_t
      local logintime_t = c_TranslateTime(logintime)
      if (os.time() - logintime_t) >= 3600*24*15 then
         c_DeleteUser("demo",username)
      end
   end
end



You may add a scheduler task with above lua scripts.
Image
FTP
Site Admin
 
posts 1200
 
joined Tue Sep 29, 2009 6:09 am

Return to Lua scripts

Who is online

Users browsing this forum: No registered users and 2 guests