Register
It is currently Wed Oct 22, 2014 5:49 pm

User's logged onto a machine


All times are UTC - 6 hours


Post new topic Reply to topic  [ 6 posts ] 
Author Message
 PostPosted: Tue Aug 29, 2006 3:15 pm   

Joined: Tue Aug 29, 2006 3:09 pm
Posts: 3
Hey Guys, I am Extremely new at this ( meaning i just loaded knoppix on Virtual PC about a week ago) which is giving me tons of problems. i am trying to get a machine i can through linux on bu8t don't have access to one at the momment

I need a script in bash that i can run using cron that I can schedule every 5 minutes or so to show what users are logged on to a machine and how long they have been logged on and append this information to a logfile. Can anyone give me a hand? I would really appreciate it


Top
 Profile  
 PostPosted: Tue Aug 29, 2006 3:26 pm   
Site Admin
User avatar

Joined: Sun May 15, 2005 9:36 pm
Posts: 669
Location: Des Moines, Iowa
desaber wrote:
Hey Guys, I am Extremely new at this ( meaning i just loaded knoppix on Virtual PC about a week ago) which is giving me tons of problems. i am trying to get a machine i can through linux on bu8t don't have access to one at the momment

I need a script in bash that i can run using cron that I can schedule every 5 minutes or so to show what users are logged on to a machine and how long they have been logged on and append this information to a logfile. Can anyone give me a hand? I would really appreciate it


Sounds alot like a homework project.....

I'll get you started anyway......

man who
use ">>"redirect to append one ">" overwrites. two ">>" appends to a file.

Should be fairly simple.


Top
 Profile WWW  
 PostPosted: Tue Aug 29, 2006 3:47 pm   

Joined: Tue Aug 29, 2006 3:09 pm
Posts: 3
It is a Homework assignment. Thank you for your help. I believe the structure should be something like this

###############################################
DAT='date +%b%d'
LOGFILE=/tmp/active.out$DAT

## Will right the user info to a logfile)
who –u >> LOGFILE

############# EOS #########


Top
 Profile  
 PostPosted: Tue Aug 29, 2006 4:02 pm   
Site Admin
User avatar

Joined: Sun May 15, 2005 9:36 pm
Posts: 669
Location: Des Moines, Iowa
maybe add

#!/bin/bash

to the beggining

exit 0

to the end ......

other than that.....looks pretty good.


Top
 Profile WWW  
 PostPosted: Tue Aug 29, 2006 4:04 pm   

Joined: Tue Aug 29, 2006 3:09 pm
Posts: 3
Thanks for the help. I appreciate it.


Top
 Profile  
 PostPosted: Tue Aug 29, 2006 8:58 pm   
Site Admin
User avatar

Joined: Sun May 15, 2005 9:36 pm
Posts: 669
Location: Des Moines, Iowa
Your welcome. ;)


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 9 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:  


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