Re: Determine if a proc spawned under screen's control
Adam Lazur <[email protected]>
| Newsgroups | gmane.comp.gnu.screen |
|---|---|
| Message-ID | <[email protected]> |
Travis Spencer ([email protected]) said: > I working as a volunteer at school, and one of the things they want me > to do all the time is search through the network for process that are > no longer being used (aka, hunt down runaways). One criteria for > determining if a process is a runaway is whether or not the user is > logged in. If he/she isn't, it is almost a sure thing that the > process has escaped control unless it was spawned during a screen > session. Since screen is very popular at school, it has to be tested > for. I have written a script to make this check, but it is unbearably > slow and inaccurate. > > Can anyone suggest a fast way that will solidly report whether the > process is currently under the control of an active screen session? Poke at the process' environment. If STY is set, it has been spawned by screen. If the process wipes its env vars... this will fail. You could also look at the name of the parent pid, if it's SCREEN, then there's a good chance it has been spawned by screen. For more paranoia, you could check out /proc/<ppid>/exe (Linux specific), and look for /usr/bin/screen. Enjoy :) -- Adam Lazur, Cluster Monkey ------------------------ Yahoo! Groups Sponsor ---------------------~--> Upgrade to 128-bit SSL Security! http://us.click.yahoo.com/qZ0LdD/yjVHAA/TtwFAA/NhFolB/TM ---------------------------------------------------------------------~-> Yahoo! Groups Links To visit your group on the web, go to: http://groups.yahoo.com/group/gnu-screen/ To unsubscribe from this group, send an email to: [email protected] Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/