Register
It is currently Sat Nov 22, 2014 5:34 pm

Not sure if this script is basic or advanced


All times are UTC - 6 hours


Post new topic Reply to topic  [ 4 posts ] 
Author Message
 PostPosted: Mon Jun 01, 2009 12:47 am   

Joined: Mon Jun 01, 2009 12:43 am
Posts: 3
I know how to do a simple hello world bash, but the knowledge stops there. I'd like to have a script that keeps track of log on/log off times of users and outputs that info to readable file. Not sure if this is possible or not, but any help pertaining to it would be very much appreciated. I have gotten as far as finding that wtmp records that activity, but I need to actually do something with it lol.


Top
 Profile  
 PostPosted: Mon Jun 01, 2009 2:40 am   

Joined: Mon Nov 17, 2008 7:25 am
Posts: 221
Dunno if this is possible (don't have a test machine at the moment).
But you should look into the "last" command which reads and formats wtmp. It should have a feature to show logon/logoff. Per default i believe it shows last logged in time.

Otherwise there's lots of good auditing tools out there that keeps track of things like this :)

ps. "lastb" should show all bad logon attempts also ds.

Best regards
Fredrik Eriksson


Top
 Profile  
 PostPosted: Mon Jun 01, 2009 3:55 pm   

Joined: Mon Jun 01, 2009 12:43 am
Posts: 3
Ok, I made a script to log those events, but I didn't really understand what I wanted it to do until I did it. What I'm really looking for is a way to make that script run every 6-12 hours and keep that file updated with all the login/log out times for users. Any clue how I would script it to do this?


Top
 Profile  
 PostPosted: Wed Jul 22, 2009 1:14 pm   
Moderator
User avatar

Joined: Wed May 03, 2006 2:05 pm
Posts: 242
The best tool for that (running a command at specific times) is probably 'cron' :)


Top
 Profile YIM  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP