- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: script for logging off users who are idle
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
Forums
Discussions
Discussions
Discussions
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
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
07-15-2005 07:16 AM
07-15-2005 07:16 AM
Thanks again for any help
John
Solved! Go to Solution.
- Tags:
- idle
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2005 07:34 AM
07-15-2005 07:34 AM
Re: script for logging off users who are idle
The pid_t data type represents process IDs. You can get the process ID of a process by calling getpid. The function getppid returns the process ID of the parent of the current process (this is also known as the parent process ID or PPID).
Your program should include the header files `unistd.h' and `sys/types.h' to use these functions.
cheers!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2005 12:54 AM
07-18-2005 12:54 AM
Re: script for logging off users who are idle
Are you trying to do this with a script or with a "C" program?
Some shells have an autologout feature as well.
-- Tom
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2005 01:11 AM
07-18-2005 01:11 AM
Re: script for logging off users who are idle
This value can be set to do just that.
Can be in the /etc/default/security file as well.
- Tags:
- TMOUT
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2005 01:45 AM
07-18-2005 01:45 AM
Re: script for logging off users who are idle
Either way a script or "C".
Rick,
I will take a look at the TMOUT variable.
Thanks again I will be assining points later. Any other info or tips are greatly appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2005 01:46 AM
07-18-2005 01:46 AM
Re: script for logging off users who are idle
TMOUT = 0
Let me find out what this means
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2005 02:18 AM
07-18-2005 02:18 AM
Re: script for logging off users who are idle
TMOUT variable (which i believe specific to BASH shell) if set to above zero in an interactive shell, the value is interpreted as the number of seconds to wait for input after issuing the primary prompt. Bash terminates after waiting for that number of seconds if input does not arrive.
but if your user is in some other program invoked in shell (like vi) then TMOUT will never occur. in that case you have to use some script to achieve this. check the output of w command, it gives IDLE time of a shell. it may be useful for u
Regards,
Gopi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2005 03:31 AM
07-18-2005 03:31 AM
Re: script for logging off users who are idle
The w command is interesting. If I am on a prompt it records. But if I am in the menu screen of my application, it does not. But I notice a few logins are actually logging in "IDLE" time. I logged into a menu screen on my application for 10 minutes and my login is still showing "null" in this field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2005 04:55 AM
07-18-2005 04:55 AM
Re: script for logging off users who are idle
Example, the TMOUT variable will work on idle shell sessions. If I am sitting at a $ prompt for 60 minutes, then kill me.
Now if I invoke a vi session, I can sit there for 60 minutes and I will not be TMOUT.
If users are not in a shell session, then investigate the app for these idle sessions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2005 05:32 AM
07-18-2005 05:32 AM
Re: script for logging off users who are idle
If you'd like to see the script, let me know. It was written for AIX and the ksh shell so should be easily adapted to hp-ux.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2005 05:55 AM
07-18-2005 05:55 AM
Re: script for logging off users who are idle
Yes if you would not mind, could you e-mail it to jimenez-j@iehp.org?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2005 05:56 AM
07-18-2005 05:56 AM
Re: script for logging off users who are idle
I don't know scripts to logout users who are idle.
Anyway a possible solution is keepalive parameters.
ndd -h | grep -i keepalive
You will see more details by
ndd -h
Hope this helps you.
Best regards,
Fabio
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2005 07:30 AM
07-19-2005 07:30 AM
Re: script for logging off users who are idle
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2005 07:50 AM
07-19-2005 07:50 AM
Re: script for logging off users who are idle
UNIX because I majored in cryptology...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2005 08:07 AM
07-19-2005 08:07 AM
Re: script for logging off users who are idle
:-) Good luck!
-- Tom
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2005 08:39 AM
07-19-2005 08:39 AM
Re: script for logging off users who are idle
I am the Admin here. Max, who is the programmer, is not here today. Would it be to much to ask you to send me what you have already. I am sure that he can modify it accordingly. If so my email adress is Jimenez-J@iehp.org
Thanks again,
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2005 11:48 PM
07-19-2005 11:48 PM
Solutionhttp://www.darkwing.com/idled/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2005 05:34 AM
07-20-2005 05:34 AM
Re: script for logging off users who are idle
I took a quick look at "idled" and it actually seems to do exactly what you need. So take a look. If you have trouble getting it to work or still need me to send you the code that I have (which would need modification to do what you need), let me know. Take care.
-- Tom
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2005 01:26 AM
07-21-2005 01:26 AM
Re: script for logging off users who are idle
Thanks
Juan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2005 02:24 AM
08-12-2005 02:24 AM
Re: script for logging off users who are idle
#!/bin/ksh
who -u | cut -c 1-10,38-50 | egrep "[12][0-9]:|old" > /var/tmp/current
for IDLE_USR in `cat /var/tmp/current | awk '{print $3}'`
do
# kill -9 $IDLE_USR
echo $IDLE_USR
done
This will kill any login shell where the user has not typed anything for 10 hours or more.
When you've tried it out and are happy that it is choosing the right processes to kill, remove the comment from the kill line and delete the echo line.
Share And Enjoy
- Tags:
- who
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2005 03:46 AM
08-12-2005 03:46 AM
Re: script for logging off users who are idle
Gordon, 99% of the users are in an application that never goes to "old" even after days of not being used.
Thanks again guys I will let you know if I have issues.