Operating System - HP-UX
1771184 Members
3336 Online
109004 Solutions
New Discussion юеВ

Users logging off incorrectly - can I catch them ?

 
Simon R Wootton
Regular Advisor

Users logging off incorrectly - can I catch them ?

RP7410 machine running HPUX 11i with 100+ users.

Many of my users are logging off the application by closing the window running the session, instead of logging out of the application first and then closing the window.

I believe this is causing issues with the application licensing and the number of concurrent users (ie. a user logs off incorrectly but the system still believes they have a session open and therefore using a license).

I'm looking for a way of tracking any such users, if possible. First thoughts were to look at the output of 'ps -ef' type commands for processes not assigned to terminals (/dev) but I'm not sure.

All help will be rewarded!

Many Thanks
Simon
7 REPLIES 7

Re: Users logging off incorrectly - can I catch them ?

Your idea is correct.Before doing that just use w to find out which terminal session is idle for long time.Then u can check for the processes which is not assigned to the terminals.
regards
SK
Your imagination is the preview of your life's coming attractions
Chris Wilshaw
Honored Contributor

Re: Users logging off incorrectly - can I catch them ?

Not sure if you can directly catch the users that are misbehaving, but you could try to catch the ones that exit cleanly, and then work out the others by exception.

In /etc/profile, set up a routine to create a login history record for them when they log in

eg:

echo 'LOGIN|`date`|`logname`|`tty`' >> $HOME/user.log

Then create use trap to create a record of when they log out;

trap "echo 'LOGOUT|`date`|`logname`|`tty`' >> $HOME/user.log" 0

You'll then have a pair of valid login/logout records for each user that performs a "correct" exit from the system (the trap of signal 0 should be ignored if they don't log out cleanly)

Obviously, you can customise the log file and location to suit your needs.
Sunil Sharma_1
Honored Contributor

Re: Users logging off incorrectly - can I catch them ?

What kind of users ? is this application users or unix users ?

Sunil
*** Dream as if you'll live forever. Live as if you'll die today ***
Stanimir
Trusted Contributor

Re: Users logging off incorrectly - can I catch them ?

Hi!
The very good idea is to put a small script in /etc/profile, which is doing the following:

1. Check if there are current session of this user:

#who -T

2. Writing in special system log the message about the user,which is trying 2nd attempt to log into application

3. Displaying a menu to choise for this user:
(1) kill old session and open new one
(2) keep old session

This way you will restrict the number of sessions for 1 user and will notify who are these users! It is not difficult to create such script using sh.

Regards,Stan




Joe Short
Super Advisor

Re: Users logging off incorrectly - can I catch them ?

The easiest solution would be to implement idle time limitations. After a predetermined idle time, the system logs the user out. It's been a while, but I beleieve you set the TMOUT variable in the user's .profile. This way, you no longer have the licensing issues, and you aren't stuck trying to educate users who just don't care.
Muthukumar_5
Honored Contributor

Re: Users logging off incorrectly - can I catch them ?

Are they closing logged session?? Using alt+f4 like that. But if you do to it will stop all the process started on that session there.

Can you check there as,

start in new session and get the status with who / w command for tty there.

In the new session start an application in backgroudn and close the window there.

Check the started process in another terminal as,

ps -ef | grep "processid"

Please twice as some time later too. Are you seeing those?? I am sure you are not.

But you can collect idle users with

# who -HT
# w -l
commands there.

Easy to suggest when don't know about the problem!
Muthukumar_5
Honored Contributor

Re: Users logging off incorrectly - can I catch them ?

Refer this for more,

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=707841

to get the idled sessions on system
Easy to suggest when don't know about the problem!