You are not logged in.

#1 2013-09-22 11:58:29

kelnoky
Member
Registered: 2007-11-20
Posts: 134

Shutdown only killing programs, not terminating?

Hey guys,

I don't use a DE or a login manager, so I startx manually and also 'shutdown -h now' or 'reboot' manually via terminal. But I always need to close most applications before shutting down, because otherwise they will complain about having crashed when I start them the next time. This is usually only an issue for Firefox and my mail program Claws, since there it actually makes a difference when the program thinks it crashed - in contrast to my various terminal-based programs etc.

So I am wondering why shutdown or reboot just flatout kills those programs. Should it not wait for them to terminate properly? It also doesn't matter whether I use the shutdown/reboot or the 'systemctl shutdown/reboot' commands, whenever I start my PC up the next time, the programs will have crashed.


Thanks for any help in advance. smile

Offline

#2 2013-09-22 13:40:32

Morn
Member
Registered: 2012-09-02
Posts: 886

Re: Shutdown only killing programs, not terminating?

If you use startx, the proper way would be to quit your applications, exit X, and then reboot from the commandline. Otherwise, as soon as X gets killed, the applications crash because they rely on the X server. If you reboot from a terminal window within X, it's really not much different from a Ctrl-Alt-Backspace, i.e. the applications do not quit the proper way—which is sometimes what you want, but usually not.

Of course if you use a DE such as KDE you get session management so everything should exit safely. But in pratice I still quit Firefox and Claws before I shutdown/reboot from the KDE menu.

Offline

#3 2013-09-22 14:31:15

kelnoky
Member
Registered: 2007-11-20
Posts: 134

Re: Shutdown only killing programs, not terminating?

Hm. But there are loads of people that don't use a DE or a login manager. Does everyone need to manually close their programs before shutting down their PC? That just seems horribly archaic and annoying to me.

Offline

#4 2013-09-22 15:20:57

ub1quit33
Member
Registered: 2013-04-30
Posts: 58

Re: Shutdown only killing programs, not terminating?

kelnoky wrote:

Hm. But there are loads of people that don't use a DE or a login manager. Does everyone need to manually close their programs before shutting down their PC? That just seems horribly archaic and annoying to me.

Yes. That's why most people use DEs, which handle that for you. Basic X environments are intentionally very simple. The X server doesn't make any assumptions about things you want it to do for you. If you want more graceful handling of a shutdown from a barebones X environment, you will need to write in that functionality or leverage something which already handles these things. This is purely theoretical conjecture, as I've never toyed with the idea of actually doing this, but you could run startx as a systemd service and leverage systemd's functionality in order to handle gracefu closing of all the child processes on a shutdown. Don't quote me on this, but I believe systemd will gracefully exit child processes before closing out a parent process. Even if that's incorrect, and it doesn't, becaise systemd tracks parent/child processes, writing systemd services which would handle closing out all X child processes gracefully and then closing X respectively as part of the shutdown target would be fairly trivial.

Offline

#5 2013-09-22 15:40:51

Morn
Member
Registered: 2012-09-02
Posts: 886

Re: Shutdown only killing programs, not terminating?

kelnoky wrote:

Hm. But there are loads of people that don't use a DE or a login manager. Does everyone need to manually close their programs before shutting down their PC? That just seems horribly archaic and annoying to me.

Why do you need to shut the system down so often in the first place? Suspend and hibernate modes work great. Just use suspend instead of shutdown and the problem is solved.

Offline

#6 2013-09-22 22:25:55

kelnoky
Member
Registered: 2007-11-20
Posts: 134

Re: Shutdown only killing programs, not terminating?

I have never actually thought about using suspend, but of course, yes - I can do that instead of shutting down.
However, I also employ a Windows 7 as my gaming OS and if I want to use that rebooting is required.

I am reasonably sure that a very large number of Arch users just uses a WM without a DE - how do they shutdown? I just can't believe that everyone always closes every application before shutting down/rebooting.

Offline

#7 2013-09-22 23:20:08

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,793

Re: Shutdown only killing programs, not terminating?

kelnoky wrote:

I have never actually thought about using suspend, but of course, yes - I can do that instead of shutting down.
However, I also employ a Windows 7 as my gaming OS and if I want to use that rebooting is required. .

Although unrelated to your problem, you can hibernate,  boot to Windows 7, play, shutdown, boot to Linux and it will "wake up" from hibernation.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#8 2013-09-23 14:15:02

anonymous_user
Member
Registered: 2009-08-28
Posts: 3,059

Re: Shutdown only killing programs, not terminating?

kelnoky wrote:

I am reasonably sure that a very large number of Arch users just uses a WM without a DE - how do they shutdown? I just can't believe that everyone always closes every application before shutting down/rebooting.

I personally do close all my programs. Perhaps a better question is how many programs do you leave open that closing them all is a hassle?

Offline

#9 2013-09-23 16:58:08

jdarnold
Member
From: Medford MA USA
Registered: 2009-12-15
Posts: 485
Website

Re: Shutdown only killing programs, not terminating?

I don't use a DE, but I do use Firefox and Claws Mail and don't have a problem with either when I do a shutdown from within a terminal, either -r or -h. I do have to exit Emacs, because it doesn't clean up nicely (leaves the desktop file around).

Offline

#10 2014-02-15 20:42:26

Alexandre Oberlin
Member
Registered: 2013-06-15
Posts: 3

Re: Shutdown only killing programs, not terminating?

Hi all,

kelnoky wrote:

I am reasonably sure that a very large number of Arch users just uses a WM without a DE - how do they shutdown? I just can't believe that everyone always closes every application before shutting down/rebooting.

Some nice solutions using wmctrl and zenity at https://bbs.archlinux.org/viewtopic.php?pid=674992

Offline

Board footer

Powered by FluxBB