LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-27-2013, 03:00 PM   #1
jjfahey
LQ Newbie
 
Registered: Mar 2013
Location: Conyers, GA
Distribution: RedHat
Posts: 3

Rep: Reputation: Disabled
Need client processes on a particular IP address


I need to determine the IP address for one or several processes, for an automated kill-script. Back in "the day" I would use their "tty" to do this, but the client processes that I am dealing with don't supply their own ttys - So I need their IP addys - I've looked a bit at the ps man pages and the like, and haven't seen anything. I know that stuff is out there somewhere, since it shows up in w and some who options, but where? Thanks in advance!
 
Old 03-27-2013, 05:19 PM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
Does this help?

Code:
# target specific processes
pkill -f <glob>

# target all processes owned by a specific user
killall -u <user>
 
1 members found this post helpful.
Old 03-27-2013, 06:47 PM   #3
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
or possibly a combination of the two?
Code:
pkill -KILL -u <user>
Warning: Do NOT use this on root!
 
1 members found this post helpful.
Old 03-27-2013, 07:12 PM   #4
jjfahey
LQ Newbie
 
Registered: Mar 2013
Location: Conyers, GA
Distribution: RedHat
Posts: 3

Original Poster
Rep: Reputation: Disabled
Unfortunately, no ... But thanks much for the responses - I am killing processes on workstations (PCs and the like) which I have determined to be idle (by database means). If I determine that all db processes on a particular IP addy are idle, then I need to kill all of them. My original script looped through all the processes on the tty (with ps -t </dev/tty##> or whatever), and killed 'em all, but now there are appears to be no simple cmd to replace <tty> with <IP>. And, of course, our users insist on logging in more than one place, so I can't just kill by logname. Ugh. I have found some stuff in /proc/<PID>/environ which may be workable, but it would've been a whole lot simpler with a "ps minus" option! Again, thanks for your input ... Cheers!
 
Old 03-27-2013, 08:12 PM   #5
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
That seems to be a strange approach .. any reason you can't set idle session timeouts on the database?
 
1 members found this post helpful.
Old 03-28-2013, 02:55 PM   #6
jjfahey
LQ Newbie
 
Registered: Mar 2013
Location: Conyers, GA
Distribution: RedHat
Posts: 3

Original Poster
Rep: Reputation: Disabled
A couple of issues there. First, our menu is also a database session, and it is almost always idle even if its children are busy, so we can't kill it just because it is idle. Of more import is the fact that we only want to "idleout" sessions if and only if ALL sessions for that IP are idle, and then we need to kill them all, including the menu session(s). Hence my need to drag IPs and PIDs "together." No worries though, I've now bolted together something using /proc/<PID>/environ which is now working for me ... I was just hoping for a simple ps <minus> option! Thanks for your input though ... Cheers! John
 
  


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
ip address of client ........ saripalli09 Linux - General 4 04-20-2011 07:04 PM
print physical address of page directories for all processes pike87 Programming 1 04-05-2011 01:59 AM
How to get the ip address of the client machine vijirin Programming 9 01-26-2011 07:22 AM
[SOLVED] dhcp-client get assigned a network address instead of a regular IP address kenneho Linux - Networking 3 11-27-2009 03:43 AM
correct way to get client ip address ? ini_hendry Linux - Networking 1 01-07-2008 05:20 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 03:39 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration