- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- terminal idle time
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-15-2009 03:47 AM
тАО10-15-2009 03:47 AM
I am writing a C program to find the log info of the users who are currently logged in(precisely what who -u do).
I am able to get all the information except the idle time. I used getuts function for getting info. The man page says getuts allows fields like ut_id, ut_type, ut_tv(login time) etc.
Can any one suggest me how to find the idle time of users currenly logged in?
thanks
R
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-15-2009 05:03 AM
тАО10-15-2009 05:03 AM
Re: terminal idle time
who -uH |more
watch the IDLE field AND use manpage of who to find more . .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-15-2009 05:16 AM
тАО10-15-2009 05:16 AM
Re: terminal idle time
Yes i've gone through it. It refers the following files: "/etc/inittab", "/etc/utmp", "/var/adm/wtmp", "/var/adm/wtmps".
To my knowledge who refers to database daemon "utmpd" for getting the log information.
and hp ux has given "getuts" for add/update/retrieve log data. thats how i came to know about 'getuts' in the first place and from getuts i couldnot get the idle time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-16-2009 12:42 AM
тАО10-16-2009 12:42 AM
Re: terminal idle time
Of course not. You get it from stat(2) on the device, st_atime.
Using tusc on who(1) would hint at this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-16-2009 01:07 AM
тАО10-16-2009 01:07 AM
Re: terminal idle time
-R
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-16-2009 03:52 AM
тАО10-16-2009 03:52 AM
Re: terminal idle time
I tried to use stat(2). As it is asking for the file path i tried giving "/etc/utmp" "etc/utmpx" and "etc/utmps". None of them returned proper last access time.
Using tusc on who(1) would hint at this.>>>>>>
Can you please elaborate this?
Thanks,
-R
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-16-2009 04:00 AM
тАО10-16-2009 04:00 AM
Solution> I tried to use stat(2). As it is asking for the file path i tried giving "/etc/utmp" "etc/utmpx" and "etc/utmps". None of them returned proper last access time.
No, you want to stat() the device file given by ' ut_line' of the 'utmps' structure. Then compute the difference between the current epoch seconds and the 'st_atime' to determine the idle interval.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-17-2009 01:34 AM
тАО10-17-2009 01:34 AM
Re: terminal idle time
As JRF said, you need to look at the input device.
>>Using tusc on who(1) would hint at this.
>Can you please elaborate this?
If you use tusc on who, you can get hints what it does:
tusc -fp -ea -o tusc.out who -u
>JRF: you want to stat() the device file given by 'ut_line' of the 'utmps' structure.
That's exactly what who(1) does.
stat("/dev/pts/tc", 0x7fffe590) ..... = 0
time(NULL) .................. = 1255771999
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-19-2009 02:18 AM
тАО10-19-2009 02:18 AM