LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-09-2013, 02:04 AM   #1
Alpha90
Member
 
Registered: Jul 2012
Posts: 93

Rep: Reputation: Disabled
How to properly shutdown running processes when stopping the X server.


I run a minimalist arch system running openbox without a desktop environments but i use select components from multiple desktop environments some of which spawn background processes such as kdeinit4 which do not properly quit when i shutdown my X server (they terminate due to an abrupt loss of connection to the X server is what i can glean from the jumbled up output to my tty).
Can a session manager accomplish that? I did not really know what a session manager was from the description initially i thought it might be like a ssh session but reading Wikipedia and Google searches I've become confused. The line i see most is that session managers can save the state of a desktop and restore it later. But i can not figure out if it will just take a snapshot of my current desktop session as i exit X and then just allow X to deal or not deal with the running processes or would a session manager be able to detect running process started during the X session and close them without terminating them abruptly.

Am i barking up the wrong tree with this path and if I am is there an elegant solution to the problem or would I need to create some sort of hackish script if i wanted this ability.
 
Old 08-09-2013, 12:07 PM   #2
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,602

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
It is up to the applications to decide what to do when the X server quits.

Session management is a hard task - remember that the processes are organized into a tree, and that the "session manager" is not necessarily at the top of the tree (at a minimum it is one level down, and there is one or more sibling trees involved). That means that terminating a session SHOULD be done by telling the "session manager" you want to log out. The session manager can then send an event to known processes that want such an event, then they wait for a reply. After a timeout, the session manager may then terminate - and terminate the X server. Many such processes now (gnome anyway) use Dbus for such notifications. If the application doesn't use dbus, then it cannot register with the session manager, OR request notification of a logout request.

Note - all of the above is strictly voluntary. If the X server terminates (or is terminated), no such voluntary event message is ever sent, nor is a response waited for. It is up to the application to choose what to do when the socket connection is closed. Well written applications will catch such events, and make suitable arrangements about terminating. Unfortunately, not all of them do; nor do they all even exit (they seem to keep trying to reconnect...)

Last edited by jpollard; 08-09-2013 at 12:08 PM. Reason: typo
 
  


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
Unable to shutdown/reboot server, no shutdown process running dctw Linux - Server 5 03-31-2010 06:46 AM
Processes are not stopping? mitchd123 Linux - General 4 04-28-2009 11:18 AM
stopping other processes TranceDude Linux - Software 8 08-28-2005 09:55 AM
stopping all processes adhiraj Linux - General 0 01-29-2004 06:19 AM
samaba server is not running properly puru_09 Linux - Networking 1 08-06-2002 08:17 PM


All times are GMT -5. The time now is 12:58 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration