Logged in users
How do I write a shell script to give me all users that have not logged in, in a certain time?
|
You can see the last login times of users with the last command. You could call that command and process the output somehow.
A more sophisticated (but ultimately probably an easier) approach is to parse the wtmp directly. There are both perl and python modules for doing this. |
Quote:
|
Yeah. I just installed the perl Sys::Utmp module, assuming it would also read wtmp, but it seems not.
The utmp/wtmp records are fixed size, so you can unpack them, but the structure differs on 64 and 32 bit systems, so you will have to cope with that. Here's something I knocked up which you can probably modify to suit your needs: Code:
#!/usr/bin/perl |
All times are GMT -5. The time now is 09:42 PM. |