LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 10-20-2010, 11:01 AM   #1
jasonws
LQ Newbie
 
Registered: Oct 2010
Location: Vermont, USA
Posts: 15

Rep: Reputation: 0
How to kill pids for all sessions for a specific user except their current one?


Hey, I have several users on handhelds and they like to let their sessions time out. Their zombie processes then cause record locks.

A solution I've come up with calls for killing the pids for any prior sessions started by a given user. This procedure would be executed in the .bash_profile. Problem is, I have no idea how to do this. Thanks in advance for any help!

Jason
 
Old 10-21-2010, 04:46 AM   #2
xandercage17
Member
 
Registered: Sep 2009
Posts: 125

Rep: Reputation: Disabled
Delete My account

Last edited by xandercage17; 04-22-2012 at 03:00 PM. Reason: Delete My account
 
Old 10-22-2010, 12:56 PM   #3
jasonws
LQ Newbie
 
Registered: Oct 2010
Location: Vermont, USA
Posts: 15

Original Poster
Rep: Reputation: 0
Thanks, I appreciate your response. I'm familiar with kill and killall, w and ps, but not the code that would do what I need it to do. Maybe this will give you a better idea of what I'm trying to do. -Jason

[root@lynx dsi]# w |grep dsi
dsi pts/7 192.168.1.120 13:53 1:21m 0.03s 0.01s sshd: dsi [priv
dsi pts/4 192.168.1.120 13:53 0.00s 0.04s 0.01s sshd: dsi [priv

#Idle for pts/7 not 0. pts/7 must be the disconnected session.

[root@lynx dsi]# ps uU dsi |grep pts7
dsi 14341 0.0 0.0 7772 1420 ? S 13:53 0:00 sshd: dsi@pts/7
dsi 14342 0.0 0.0 4316 1440 pts/7 Ss 13:53 0:00 -bash

#Grab pids and kill them:
kill 14341 14342
sleep 10
kill -9 14341 14342

Last edited by jasonws; 10-22-2010 at 01:00 PM.
 
Old 10-22-2010, 03:39 PM   #4
jasonws
LQ Newbie
 
Registered: Oct 2010
Location: Vermont, USA
Posts: 15

Original Poster
Rep: Reputation: 0
I figured some things out and started a new thread here:
http://www.linuxquestions.org/questi...18#post4136218
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Kill specific vnc user from joint session jo4 Linux - Newbie 1 05-07-2011 03:08 AM
Number of current sessions for user neel_learning_linux Linux - Newbie 5 05-13-2009 03:14 PM
Can you kill off other sessions (gui and terminal) Thaidog Linux - General 2 03-30-2008 03:51 PM
Log Out a Specific User (KILL) carlosinfl Linux - General 8 08-29-2007 10:53 AM
kill opened sessions aizkorri Linux - Newbie 3 09-25-2003 09:08 AM


All times are GMT -5. The time now is 11:37 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration