Operating System - Tru64 Unix
1829404 Members
1807 Online
109991 Solutions
New Discussion

the output of the 'w' command

 
SOLVED
Go to solution
hy_3
Frequent Advisor

the output of the 'w' command

OS is V4.0F.When I execute the 'w' command,the output likes this:
#w
11:15 up 10 days, 14:44, 33 users, load average: 0.00, 0.00, 0.00
User tty from what
tfdcz t0 runmenu50x -c
xqz p1 10.137.72.66 runmenu50x -c
zbzz p2 10.137.72.66 runmenu50x -c
The user 'xqz' and 'zbzz' have the same ip address,and the user 'xqz' has logged out.What is the matter?Thank you.
12 REPLIES 12
Ravi_8
Honored Contributor
Solution

Re: the output of the 'w' command

Hi,

both the users have logged in from the same machine (10.137.72.66).

$ w
18:43 up 15 days, 2 mins, 2 users, load average: 0.01, 0.00, 0.00
User tty from login@ idle JCPU PCPU what
root pts/1 BENAKA-udp290969 18:41 1 -sh
mqm pts/2 BENAKA-udp290969 18:42 w

in this my machine users root and mqm have logged in from same machine named BENAKA.

when the user root logged out

$ w
18:43 up 15 days, 2 mins, 1 user, load average: 0.01, 0.00, 0.00
User tty from login@ idle JCPU PCPU what
mqm pts/2 BENAKA-udp290969 18:42 w

user root will not be shown.
never give up
hy_3
Frequent Advisor

Re: the output of the 'w' command

Thank you.I see.
hy_3
Frequent Advisor

Re: the output of the 'w' command

My question is when a user logged out,the 'w' command display the user however.Thank you.
Ravi_8
Honored Contributor

Re: the output of the 'w' command

Hi

This is because sometimes even when the users really logged out, file handle allocated to that user by the OS will not be released( it's not a hram at all). after a reboot it will be normal.
never give up
Michael Schulte zur Sur
Honored Contributor

Re: the output of the 'w' command

Hi,

The user 'xqz' and 'zbzz' have the same ip address
One can have more than one telnet session and login with more than one user.

Usually, if you log out, the programmes you run, are killed. It may however happen, due to a trap in the users profile or the application ignoring the hangup signal, that processes stay.

Michael
hy_3
Frequent Advisor

Re: the output of the 'w' command

Then how can I avoid it?Thank you.
Michael Schulte zur Sur
Honored Contributor

Re: the output of the 'w' command

Avoid what?

Michael
hy_3
Frequent Advisor

Re: the output of the 'w' command

Avoid "It may however happen, due to a trap in the users profile or the application ignoring the hangup signal, that processes stay." Can I avoid it?Thank you.

Michael Schulte zur Sur
Honored Contributor

Re: the output of the 'w' command

Hi,

now I know, you were meaning me. ;-)

Look into the .profile of the users and if there is a trap, which uses 1, take the 1 out.
trap 1 means: ignore hangup signal in the processes, the shell creates.

greetings,

Michael
hy_3
Frequent Advisor

Re: the output of the 'w' command

Thank you.Then could you tell me what the trap 2,trap 3 and so on means?
Johan Brusche
Honored Contributor

Re: the output of the 'w' command


The number behind the trap statement are signal numbers, they are defined in /usr/include/signal.h
#define SIGHUP 1 /* hangup, generated when terminal disconnects */
#define SIGINT 2 /* interrupt, generated from terminal special char */
#define SIGQUIT 3 /* (*) quit, generated from terminal special char */
#define SIGILL 4 /* (*) illegal instruction (not reset when caught)*/
#define SIGTRAP 5 /* (*) trace trap (not reset when caught) */
#define SIGABRT 6 /* (*) abort process */
#define SIGEMT 7 /* (*) EMT instruction */
#define SIGFPE 8 /* (*) floating point exception */
#define SIGKILL 9 /* kill (cannot be caught or ignored) */
#define SIGBUS 10 /* (*) bus error (specification exception) */
#define SIGSEGV 11 /* (*) segmentation violation */
........

These are the same number that you would use with the kill command to stop a program in a certain way, eg kill -9 = kill -HUP

Johan.

_JB_
hy_3
Frequent Advisor

Re: the output of the 'w' command

Thank Michael and Johan.I love this forums.