Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Dean Karres
September 8, 2008, 3:52 pm
rate this thread
I know how to read and "tail" the Utmp files on the systems I have
access to. We now have OSX machines that are using the Utmpx system
and the records are not as straight forward to read.
I am looking at the User::Utmp modure since it will handle either type
of file. However it appears that it will read in the WHOLE Utmp(x)
file at one time and then hand the caller an array of hashes that
represents the file.
There is nothing wrong with that except I need to constantly be made
aware of new Utmp(x) entries as they appear. Closing and reopening
the Utmp(x) file and re-reading to to pull in a possible new couple of
lines seems very wasteful.
Do you have ideas?
- Michael Piotrowski
September 12, 2008, 1:12 pm
Re: "tailing" utmp(x)?
Yes, that's right.
Well, it's not particularly clever, either ;-) (as the author I can say
The utmpx file format is opaque and the file may only be accessed using
the corresponding functions (getutxline(), etc.) Thus, the question is
whether it works reliably to call getutxent() in an infinite loop to get
newly added records. I haven't tried this yet. However, getutxent()
returns NULL both on failure and at the end of the database, so it would
not be possible to detect errors.
Public key at <http://www.dynalabs.de/mxp/pubkey.txt (ID 0x1614A044)
- » Proxy method does not work using LWP::UserAgent for HTTPS request
- — Next thread in » PERL Modules Announcements