Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Can it hurt if I shut down my machine without closing all programs? I normally close all of them by hand, but have heard from others that this is really not necessary anymore (i.e. Linux will take care of proper closing of programs before shutting down the computer). I normally run applications like Thunderbird, VIM (with no unsaved files opened), and browser windows when I shut down my pc. And I would make sure not to be writing anything to USB when shutting down.

Running Arch Linux and shutting down using ConsoleKit.

share|improve this question
2  
You need to define precisely what "shutdown my machine" means to you, as any answer will depend on that. Possibilities include sudo shutdown, sudo halt, pressing the power button, holding down the power button, and even pulling the plug out of the wall. –  Kyle Jones Jun 14 '12 at 0:17
    
See my post: "Shutting down using ConsoleKit". Will add a link for further details. Also, any idea why the downvote?? –  user Jun 14 '12 at 0:45
    
Related: Should I unmount a USB drive before unplugging it? So do unmount these USB devices. –  Gilles Jun 14 '12 at 1:52
    
Thanks Gilles, but this is not about unmounting before unplugging. This post (unix.stackexchange.com/questions/12767/…) suggest that I can in fact safely shut down with USB plugged in. Or am I interpreting things wrongly? –  user Jun 14 '12 at 1:55
add comment

3 Answers 3

up vote 3 down vote accepted

TL;DR

It's a best-practice to close any applications that might have unsaved data before shutting down.

Longer Explanation

It is the individual application's responsibility to gracefully handle a SIGTERM, but there are certainly cases where this will not suffice. Two examples that could cause data loss are:

  1. An application does not properly handle (or even ignores) SIGTERM.
  2. The application takes longer to save its data than the system allows before sending SIGKILL (e.g. around 5 seconds on Ubuntu according to the upstart cookbok).

A Few Practical Examples

I would personally recommend closing open documents in your text editor or word processor, but I wouldn't worry about Tomboy notes or open Firefox tabs. You should probably take care with any bulk file transfers in Nautilus, but I wouldn't worry about a resumable download with wget or transmission.

Like all things Unix-like, YMMV.

share|improve this answer
    
Thanks, understood. But with only programs like Thunderbird, VIM, and Firefox/Chrome opened, I should be fine? –  user Jun 15 '12 at 11:58
add comment

From anecdotal experience (mine, in the bunch of systems I use everyday), I always shutdown my system with apps running (but no unsaved files) and never had any problems.

share|improve this answer
add comment

Depends on the applications that are active when you are shutting down. All applications receive a shutdown message and they have to act on it. If it's not forced they can chose to abort the shutdown.

share|improve this answer
    
I'm sorry to nitpick but what do you mean with "abort the shutdown"? As far as i know there is no way an application can cancel a shutdown through a standardized interface on Linux. It depends also on your shutdown scripts if all application will receive either SIGTERM, SIGKILL, or both. –  Ulrich Dangel Jun 14 '12 at 0:31
    
SIGKILL cannot be trapped while SIGTERM can be. If the application chose to handle the SIGTERM signal it practically stops the shutdown process. Eg vi can chose to remain active to save any unsaved files etc. –  Ganesh Krishnan Jun 14 '12 at 0:38
2  
You are right but the problem is you are mixing the term shutdown. If a shutdown is in process e.g. switch to init level 0 / shutdown -h now there is as far as i know now way an application can cancel it. –  Ulrich Dangel Jun 14 '12 at 0:42
    
An application can't "choose to abort the shutdown" -- the system asks (SIGTERM), and then forces (SIGKILL) all applications to close. They have no say in the matter. –  Chris Down Jun 14 '12 at 1:31
    
Some GUI applications can notify the desktop environment that they wish to abort a logout. This is far from universal, it requires cooperation between the application and the DE. And it doesn't apply to a system shutdown (though the DE might first perform a logout preparation before initiating a shutdown, so from a user experience perspective it does apply to a shutdown triggered from the DE). –  Gilles Jun 14 '12 at 1:49
show 3 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.