Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

While running alpha/beta Ubuntu, I have often had problems where X freezes and I would have to restart X.

During this freeze, I'm able to switch to a tty and shutdown the programs. I either use top and kill the running apps[evolution/firefox/etc,..], or use killall commands.

But when I use those kill commands, the application shuts-down abruptly and when opening in the next session it 'recovers'. ex: Firefox needs to restore all the web-pages I was viewing, so if I had 20-30 tabs open it will literally freeze for a few mins. evolution would not have deleted messages in trash, etc..

Is there a command I can use to shutdown applications cleanly from a tty? [apps that i use regularly are firefox,evolution,transmission,xchat]

share|improve this question
    
I don't know much about X internals, but I guess you could somehow deliver the close window event to the proper window handler, however it would not work on your case because X itself which haandles the messages is hang. To make things even more complex most of those apps have additional prompts when they are closed. –  João Pinto Nov 27 '10 at 18:44

3 Answers 3

up vote 5 down vote accepted

The standard way to notify a POSIX application to close, while still having a grace period to do cleanup is to send it the SIGTERM (wikipedia link) signal. The SIGKILL (wikipedia link) signal, on the other hand, kills the application without even giving it a chance to tidy up.

However… both of your actions - calling top (by the way I would recommend that you switch to use htop instead of top) or killall - send the SIGTERM signal by default.

And I have just tested firing Firefox up - and trying it both with SIGKILL and SIGTERM. With SIGTERM, when I took Firefox again, I did not get any error or "restoration" message. With SIGKILL, I got the it's embarrassing screen.

So, the reason is simple: The instance of X for these apps is frozen. All these GUI applications operate under the premise that their instance of X is functioning properly. They probably cannot even try anything if X is frozen.

The way to solve your problem is to determine why X is freezing, and prevent that from happening.

Edit: Ah, sorry - just saw that you talk about using the Ubuntu alpha/beta when X freezes. In which case… I would say it is part of the excitement of running an alpha/beta. Try to understand why it freezes, write/add to a bug report. In order to speed Firefox's startup in these, simply tell it to not reload the same tabs when it reopens. (You can still find these tabs in history). For the other applications, their cleanup actions are rather trivial - it should not cost you much that they didn't happen.

share|improve this answer
    
Yea, sending '$ kill -TERM PID' at times does seem to be better. Oh! and I do report bugs. ;) –  Vish Nov 27 '10 at 21:20
1  
@Vish: SIGTERM is the default signal for most task-killing programs. There is no reason why kill -TERM $PID would have better results than using top or killall with the default parameters. –  jhominal Nov 27 '10 at 22:15
    
Ah, then it was just my head making it seem better. - I wonder if system monitor does anything different with its end/kill process. Someone should write an universal 'Quit' command. And make it industrial standard. ;p –  Vish Nov 28 '10 at 18:49
    
@Vish: As far as I know, System Monitor sends a SIGTERM when you use it to end a process. And a SIGKILL if the app hasn't exited after some time / if the user tries it again (and Windows does something nearly identical). I could be mistaken though, as I rarely use the System Monitor. –  jhominal Nov 28 '10 at 20:35
    
Since the closest ans seems to be no such command . jhominal's answer is the closest. But it does not solve the issue though. - not sure if this question can be marked solved but it seems 'answered' ;). –  Vish Jan 20 '11 at 9:03

Do you have both browser.sessionstore.enabled and browser.sessionstore.resume_from_crash set to true in about:config? Seems to have worked for me :)

share|improve this answer
    
Yeah, i do have them, but i was looking to for a command for all apps, like a 'killall $foo'. (but a cleaner quit one) –  Vish Jan 20 '11 at 9:01

hello i guess to reboot your machine nicely just hold the right ALT+sysReq then type REUISB and it will reboot those letters has a meaning but im not sue but you can search for it i hop it will help

peace out

share|improve this answer

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.