Operating System - HP-UX
1849273 Members
5821 Online
104042 Solutions
New Discussion

Re: Obtaining PID from wtmp

 
SOLVED
Go to solution
Steve Mills_1
Occasional Contributor

Obtaining PID from wtmp

I am trying to extract PIDs from the the wtmp file, to marry up with the other login info.

i.e.
Using the 'last' command with '-R' gives:
'user' 'type of entry' 'originating address' 'time' etc.

However, the 'wtmp' manpage reports the structure of the file to include PIDs.

Can anyone advise how I can extract this PID information

thanks
Steve

5 REPLIES 5
Rodney Hills
Honored Contributor
Solution

Re: Obtaining PID from wtmp

The "who" command can do this-

who -u /var/adm/wtmp

Will list the pid's...

-- Rod Hills
There be dragons...
A. Clay Stephenson
Acclaimed Contributor

Re: Obtaining PID from wtmp

Hi Steve:

You can use the fwtmp to convert the binary wtmp data to text. e.g. /usr/sbin/acct/fwtmp < /etc/wtmp will list the data to stdout.

Man fwtmp for details.
If it ain't broke, I can fix that.
Craig Rants
Honored Contributor

Re: Obtaining PID from wtmp

who -T and who -u will both give you the PID information.

GL,
C
"In theory, there is no difference between theory and practice. But, in practice, there is. " Jan L.A. van de Snepscheut
Helen French
Honored Contributor

Re: Obtaining PID from wtmp

Hi,

Try this:

# /usr/sbin/acct/fwtmp < /etc/wtmp > /tmp/wtmp

This will convert the wtmp file to text and you can read the PID from this file. See this link for more information:

http://www.docs.hp.com/cgi-bin/fsearch/framedisplay?top=/hpux/onlinedocs/B2355-90681/B2355-90681_top.html&con=/hpux/onlinedocs/B2355-90681/00/01/113-con.html&toc=/hpux/onlinedocs/B2355-90681/00/01/113-toc.html&searchterms=fwtmp&queryid=20020219-072530

HTH,
Shiju

Life is a promise, fulfill it!
Steve Mills_1
Occasional Contributor

Re: Obtaining PID from wtmp

Thanks fellas - just what I wanted.

Cheers
Steve