Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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!
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!
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.