User Tools

Site Tools


lastaccountloginexample

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

lastaccountloginexample [2014/09/16 15:32] (current)
wikiadmin created
Line 1: Line 1:
 +==== Last account login =====
 +Source code:
 +
 +<file python>
 +#!python
 +import vms.user, vms.starlet,​ vms.uaidef
 +def fcmp(u1, u2):
 +    return cmp(u2.lastlogin_i,​ u1.lastlogin_i)
 +users = vms.user.all_users()
 +users = users.values()
 +# descending sort on last login interactive
 +users.sort(fcmp)
 +s,delta = vms.starlet.bintim('​31 0:​0:​0.00'​)
 +s,curtim = vms.starlet.asctim()
 +s,minlogin = vms.starlet.bintim(curtim)
 +minlogin += delta
 +for user in users:
 +    if (not (user.flags & vms.uaidef.UAI_M_DISACNT) and 
 +        0 < user.lastlogin_i < minlogin):
 +        print "%-33s %s" % (user.username, ​
 +                            vms.starlet.asctim(user.lastlogin_i)[1])
 +</​file>​
 +Result:
 +
 +<​code>​
 +USER_1 ​                           28-JUL-2004 20:16:25.27
 +USER_2 ​                           27-JUN-2004 04:05:31.54
 +USER_3 ​                           28-APR-2004 18:37:59.54
 +USER_4 ​                            ​4-DEC-2003 17:25:37.28
 +USER_5 ​                            ​2-JUL-2003 14:33:58.49
 +USER_6 ​                           27-SEP-2002 12:49:57.24
 +USER_7 ​                           24-MAY-2002 14:56:33.61
 +USER_8 ​                            ​1-OCT-2001 21:42:28.67
 +</​code>​
  
lastaccountloginexample.txt ยท Last modified: 2014/09/16 15:32 by wikiadmin