Logon/Logoff script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Logon/Logoff script
# 1  
Old 09-21-2010
Logon/Logoff script

I need help for writing a logon/logoff script for recording user's computer usage time. This is for local login only, not for ssh or something like that.

When a user logon, there should be a temp file (/home/acct/login_temp) generated including the logname and logon time information in the format like "LogName LogonTime".

When a user logoff, combine temp file and logoff time (in the format of "LogName LogonTime LogffTime"), and append the line to the file /home/acct/Log.txt".

The time format should be hh:mm:ss MM/DD/YY. and the logname should take 10 character (add space if needed).

I guess this is quite a simple job to most of your guys. Hope I can get help here.

Thanks in advance.
# 2  
Old 09-21-2010
Hint: One approach is to write a wrapper program around your login shell (which is called from the /etc/passwd file).

Give it a try and post your results/attempts at writing this wrapper.
# 3  
Old 09-21-2010
I am windows guy and very new to linux and linux script. I don't understand you answer at all. I need more specific help. Thanks.
# 4  
Old 09-21-2010
Sounds to me that, based on your location, you are a student at Iowa State University.

Did you read our forum rules on how to post homework?
# 5  
Old 09-21-2010
Yes, you are right, my IP tells you that I am from Iowa State. But what make you think I am a student? Your act is really not that professional.
# 6  
Old 09-21-2010
Quote:
Originally Posted by jimx
Yes, you are right, my IP tells you that I am from Iowa State. But what make you think I am a student? Your act is really not that professional.
Your domain ends in .edu.

Is it not a bit of a giveaway?
# 7  
Old 09-21-2010
I can not believe people at this forum think that the .edu is for student only. Speechless.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find logon user based on executed script proc id

Hi, i have requirement to find logged in user based on process id. i have below scenario. 1. all my users will logon to unix box using ssh from windows system. 2. after successful logon they will sudo to common user. ex. sudo -su edadm lot of users are executing jobs from edadm user and... (2 Replies)
Discussion started by: tmalik79
2 Replies

2. Shell Programming and Scripting

My script stops after logoff...why??

Hi' i am runing a script thats run with a loop...while loop true. when i exit the server..logon and again the script doenst run. its a bash script test.sh. i run it as: #./test.sh & what can be the priblem please? thanks alot (6 Replies)
Discussion started by: zigizag
6 Replies

3. Shell Programming and Scripting

Case Statement for Login/Logoff Script

I'm currently trying to write a login script. I have already written a logoff script that uses an if/else statement. #!/bin/bash TIMED=$(date +%H) if ' then echo Have a Great Day $USER else echo Have a Great Night $USER fi But I'd like to write one that give me the option of... (1 Reply)
Discussion started by: bbowers
1 Replies

4. Shell Programming and Scripting

Logon profile kill script only partially working

I have been having an issue with the new motorola rf scan guns opening up too many sessions at once. It seems they will open a new connection for no reason, leaving the old one in the background and the user has no idea it is happening. To combat this, I have added the following code to the logon... (1 Reply)
Discussion started by: raidzero
1 Replies

5. Shell Programming and Scripting

How to script to logon servers using id and password

Hey.. I am new in scripting.. I know a little bit of scripting.. I am facing some problem.. I need to create a script using which I may log on to a server (e.g. ftp) with ID and password.. thus copy a particular file to a local dir.. the commands required to do that I do know.. I am able to do it... (1 Reply)
Discussion started by: razeeev
1 Replies

6. UNIX for Dummies Questions & Answers

UNIX logon script/batch

Hi everyone, I am a newbies to Unix and hope someone can help me on: 1. Do anyone has batch file example that can be logon to a unix sever through telnet and exec a nohup command without typing in username and passward everytime ? 2. A java script exmaple for doing the same logon so it... (1 Reply)
Discussion started by: oht
1 Replies

7. UNIX for Advanced & Expert Users

Running a script during logoff

I know we can put whatever we need to run during login inside /etc/profile or .profile file. I want to run a set of commands before logoff. Where should I put my commands/scripts? Is such facility available? (3 Replies)
Discussion started by: praveenkumar_l
3 Replies

8. UNIX for Dummies Questions & Answers

Logon script

Hi: I am wondering if anyone has a logon script to be put in /etc/profile or environments that will display the logged on username and path? (4 Replies)
Discussion started by: capeme
4 Replies

9. AIX

umask setting on a logon script

hi, am new to AIX. i have an issue. iam asked to change the umask setting on a logon script on a server to prevent writable files. i logged in as the root user and typed in umask and it displays 022, which i believe is 755 for direc and 644 for files. 1) how to I identify where the logon script... (2 Replies)
Discussion started by: karthikosu
2 Replies

10. UNIX for Dummies Questions & Answers

logoff idle user script

Will someone please share a script with me that will read in each line of the who -u output and if idle time is more than 50 min, execute a kill on the PID? This is what I have so far: who -u | cut -c 40-56 I am comfortable in the korn shell, but I can broaden my horizons if you've got... (4 Replies)
Discussion started by: michieka
4 Replies
Login or Register to Ask a Question