Ok. I understand X session is a bit vague here so let me clarify what I mean by the phrase. I mean the situation where a person has been presented with a display manger screen ( eg xdm, kdm, gdm, mdm, lightDM ,,, ), "logs in", has finished using the computer, "logs out", the display manager screen is restored.

In the last step, processes that are not direct descendents of something like SSH or agetty should all go away.

I wish to place cleanup scripts between the "logs out" and the restoring of the display manager.

I need to know how X notifies other programs that the window manager is going down, and possibly how to pause the exit, if a program requires it.

  • 1
    Programs that you start as children of the X window manager should receive a signal. Unless the program catches the signal, they die. Any programs which you daemonize (fork/fork/setsid) will not receive signal that parent died, because they are their own process group leader. You will need to record their pid and kill them separately (if you want to). – ChuckCottrill Oct 15 '13 at 4:54
  • If I run a command in Xsession.d, such as my_program &, does it run as a child of X, or is it daemonized? – Azmisov Oct 20 '14 at 16:08
  • @Azmisov As a child process. You can check this with pstree. – Kusalananda Jul 30 '16 at 11:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.