LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-25-2010, 10:05 PM   #1
kevinbenko
Member
 
Registered: Jun 2005
Location: Fargo, North Dakota
Distribution: Debian Stable {Probably forever}
Posts: 628

Rep: Reputation: 174Reputation: 174
Question Requesting a Feasibility/Sanity Check on a Job Control Issue


Greetings:

I need a sanity check on something I want to do:

When a user logs out of their session, have the appropriate KDM config file (/etc/kde4/kdm/Xsetup) kill only certain applications from only that particular dead session (xplanet and kmail are the only culprits I've noted, thus far). I don't want other sessions affected.

Is this feasible, and can anyone think of any unintended consequences?

[[I see the potential for race conditions, which tells me that I want to use semaphores.]]

Thank you for your time.

Last edited by kevinbenko; 09-25-2010 at 10:08 PM. Reason: Append ending statement thanking readers for taking the time to read my question.
 
Old 09-26-2010, 02:35 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
First of all if applications like xplanet or kmail appear to be hanging then you should look into the reasons *why*. If it appears to be related to saving data then abruptly interrupting processes may lead to whining and gnashing of teeth (aka data loss). If OTOH they're just slow then maybe that should be fixed by those application developers. What I mean is that treating the cause is preferable to just treating symptoms. As far as process selectors go, if applications are started by the user manually and from within the Desktop Environment then there will be similarities in UID, Parent PID, Session ID et cetera. Take for example Firefox started by its 'firefox' shell script as '/bin/sh /path/to/firefox/firefox -ProfileManager'. Its PID is 'pgrep -f 'firefox -ProfileManager';', so its children are 'pgrep -g $(pgrep -f 'firefox -ProfileManager') -l'. Now DE's may autostart processes (so PPID may be 1) and some processes create other processes. Running a forest display from within ${LOGNAME}s session like this should show: '/bin/ps U $LOGNAME xfo pid,ppid,pgid,sid,sess,uid,cmd --sort=pid' what possibilities you have. In short you could say that unless $LOGNAME has more sessions running in (p)killing processes your widest selector can then be the UID (see with 'pgrep -U $LOGNAME -l') so killing for example 'kmail' could be expressed as 'pkill -9 -u $LOGNAME kmail'. I hope that wasn't too convoluted.
 
Old 09-26-2010, 05:08 AM   #3
kevinbenko
Member
 
Registered: Jun 2005
Location: Fargo, North Dakota
Distribution: Debian Stable {Probably forever}
Posts: 628

Original Poster
Rep: Reputation: 174Reputation: 174
The actual implementation of the killing of the applications isn't a problem (sed+grep+awk on the tail end of logs in /var/log), and the problem isn't with the applications themselves, it's that sometimes processes get pushed into the background and disowned by their parent process via the "&" and the "disown" bash shell command

I'm just looking for possible annoyances that could pop up. I've already accounted for the fact that a single user could be logged into multiple sessions.
Can anyone see any potential race conditions popping up with this sort of thing?
I'm assuming that there will be race conditions, but I can't seem to think of any off the top of my head.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sanity Check DotHQ Linux - General 6 03-31-2006 09:24 PM
./configure sanity check xushi Slackware 9 06-18-2005 04:47 PM
cpp sanity check alexrait1 Slackware 6 04-24-2005 08:43 AM
sanity check failed for g++ pablovschby Programming 2 11-08-2004 02:39 AM
Quick Sanity Check sub-genius Slackware 5 07-15-2003 11:28 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:45 PM.

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