Sponsored Content
Full Discussion: how to fetch idle time
Operating Systems HP-UX how to fetch idle time Post 302362245 by bhiku matre on Thursday 15th of October 2009 10:52:47 AM
Old 10-15-2009
Question how to fetch idle time

HP-UX B.11.23 ia64

Hi everyone,

First of all I am new member to this forum. Thankyou all for this forum, it helped me many times.

Coming to my question,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 fetch the idle time of users currenly logged in?

Last edited by bhiku matre; 10-15-2009 at 11:55 AM.. Reason: Forgot to mention hp ux version I am on
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Findout Idle Time Setting

Hi Guru's, How do I find and set the login idle time setting in HP-UX 32? Thanks in advance, Mani (1 Reply)
Discussion started by: jvmani
1 Replies

2. Shell Programming and Scripting

finding idle time of a process

Matez, I have a list of process id's in a text file. I want to know how to find the idle time of a process which are more than 300secs and kill them accordingly. Could you please help me to get these details. I want to write a shell script with this. Thanks..Krish :) (36 Replies)
Discussion started by: Krrishv
36 Replies

3. UNIX for Advanced & Expert Users

How To Fetch Time From Putside Source On Unix Platform?

CAN ANY PLESE TEL ME,HOW CAN I FETCH TIME FROM SOME EXTERNAL SOURCE (eg. NETWORK TIME SERVER S 200) ON UNIX PLATFORM,PROVIDED TIME IS COMING FROM SOME IP "X".WHAT CODE SHOULD I RUN IN STARTUP (2 Replies)
Discussion started by: pesty
2 Replies

4. Shell Programming and Scripting

User Idle Time

Does anyone know how do you determine the user idle time of stdin in order to log the user out for being idle too long. I would like to write a c program to do this but I it is not clear upon how to determine idle time from keyboard input. (9 Replies)
Discussion started by: cpaquette
9 Replies

5. HP-UX

vmstat displays cpu idle time at 100%

Since yesterday the vmstat command is displaying the cpu idle time at 100%At each time interval. It never changes. Not sure what it means other than it Quit calculating that stat. And I'm curious why. Using sar I can display a correctCpu idle percent, but vmstat does not. Any ideas why or... (2 Replies)
Discussion started by: tfrye
2 Replies

6. UNIX for Advanced & Expert Users

To find idle time of a user

Hi All I need to find the idle time of a user... but my OS seems to be not supporting finger $ finger -sh: finger: command not found I need to find the idle time and perform some other operations... So is there any other way i can find the idle time of a user... $ uname -a... (2 Replies)
Discussion started by: Whiteboard
2 Replies

7. UNIX for Advanced & Expert Users

idle time again

I need to find the idle time on a machine in the manner: How long time ago somebody did the last action with mouse or keyboard? Unfortunately "w" doesn't do this. It produced the following output on a machine a user was actually working on with an application: 15# w 15:55:28 up 15 days, ... (1 Reply)
Discussion started by: elbrand
1 Replies

8. Red Hat

Mouse freezing after idle time

Hi All, I am having a problem where my mouse (USB) is freezing after some idle time, and I am having to reboot everytime that happens. I looked in the file /etc/X11/xorg.config to see if there is an entry for mouse and I could not find it. Instead I found the following entry: Section... (8 Replies)
Discussion started by: jxh461
8 Replies

9. Shell Programming and Scripting

User idle time and kill

Hello.. I have many sleepy users on my Solaris box and need to kill them if they are idle for more than 45 minutes for example...I know who -u gives and the idle time but unable to make a awk line to get the condition perfect. Please help...:wall: (9 Replies)
Discussion started by: wimaxpole
9 Replies

10. Shell Programming and Scripting

Need to get average idle time using mpstat

I want to get average idle time of the server using mpstat. The problem I am having is %idle is not in same columns in all the versions of linux. example 1: example 2: I tried below command as generalized solution but as Average as one less column output is not proper. I am... (1 Reply)
Discussion started by: kumarjohn
1 Replies
getuts(3C)																getuts(3C)

NAME
getuts: endutsent(), getutsent(), getutsid(), getutsline(), pututsline(), setutsent(), ENDUTSENT(), GETUTSENT(), GETUTSID(), GETUTSLINE(), PUTUTSLINE(), SETUTSENT(), - access and update routines for user-accounting database maintained by utmpd SYNOPSIS
Remarks The size of the structure (for example is passed as utmps_size parameter in the above calls. A macro equivalent exists for each of the above function calls. These macros provide a shorthand way of calling getuts(3C) functions, by implicitly passing the utmps_size parameter to the corresponding getuts(3C) function. DESCRIPTION
and each return a pointer to a structure, the key elements of the structure are char ut_user[] User login name char ut_id[] Unique Id to distinguish an entry char ut_line[] Device name pid_t ut_pid Process Id short ut_type Type of Entry struct ut_exit The exit status of a process struct timeval ut_tv Time entry was made char ut_host[] Host name, if remote uint8_t ut_addr[] Internet Address of the Host, if remote short ut_addr_type Flag to identify type of address in ut_addr Routines This call returns the next record from the in-memory user accounting database maintained by utmpd(1M). When the end of the database is reached fails and returns NULL. The macro is a wrapper around and implicitly passes the utmps_size parameter. For entries of ut_type matching and searches the database for an entry matching id->ut_id field. The record is fetched irre- spective of the current position in the internal ordering and does not alter the current position in the inter- nal ordering for the API. If ut_type specified is or fetches an entry with a ut_type matching id->ut_type. If no matching entry is found fails and returns NULL. The macro is a wrapper around and implicitly passes the utmps_size parameter to This is similar to It searches the utmpd(1M)'s database for an entry of type or that also has the ut_line field matching the line->ut_line string. If the entry is not found in the database, fails and returns NULL. The record is fetched irrespective of the current position in the internal ordering and does not alter the internal ordering for the API. The macro is a wrapper around and implicitly passes the utmps_size parameter to Writes out the supplied structure into the in-memory user accounting database maintained by utmpd(1M). For entries of ut_type matching and searches the utmpd(1M)'s database for an entry matching utmps->ut_id field. If the entry already exists in the utmpd(1M)'s database, this API updates the entry already present. Otherwise, adds a new entry into the utmpd(1M)'s database. If ut_type specified is or updates the entry with ut_type matching utmps->ut_type. The macro is a wrapper around and implicitly passes the utmps_size parameter to This API searches the utmpd(1M)'s database for an entry with ut_pid matching the pid argument. Since pid has significance only for currently ACTIVE processes, matching is done only for entries of type or On finding a matching entry, returns the corresponding entry; otherwise, fails and returns NULL. The macro is a wrapper around and implicitly passes the utmps_size parameter to Resets the requests for to begin from the start of the utmpd(1M)'s database. It also clears out the static structure. The macro is a wrapper around It closes any open file descriptors and clears out the static structure. The macro is a wrapper around The specific calling convention of passing the expected data structure size is used in order to allow for future expansion of the inter- face, and the structure while preserving backward compatibility for programs written using the getuts(3C) interfaces. The interfaces encode the version information of the structure in the utmps_size parameter. Should the structure change in a future release, utmpd(1M) and libc interfaces detect the version of the structure the application was compiled with based on the utmps_size param- eter and return the appropriate structure. The getuts(3C) interfaces use file only when the utmpd(1M) is not running. This feature may be discontinued in a future release. The field in the structure can hold a 16 byte IPv6 address. In case applications want to write a four byte IPv4 address into this field, they must initialize the field to and use the last four bytes of the field. Applications which write an IPv6 address into the field must initialize the to and are macros defined in header file. RETURN VALUE
and return a pointer to static structure on success. On failure they return NULL. ERRORS
The size parameter passed to the functions does not match any of the structure sizes supported by the server. WARNINGS
If the size of a member of the structure changes in a future release, applications compiled with older version of the structure will get truncated information for the structure fields that have expanded. To get the complete information, the applications have to be re-com- piled. The value returned by and points to a single static area that is overwritten by each call to any of the functions, so it must be copied if it is to be saved. AUTHOR
The routines were developed by Hewlett-Packard Company. FILES
SEE ALSO
utmpd(1M), bwtmps(3C), thread_safety(5). getuts(3C)
All times are GMT -4. The time now is 10:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy