Doing a "friendly" shutdown
I'm running Arch Linux with Openbox and I have a few programs that start automatically on boot for me (like XMMS, it's a DJ comp.) I'd like to write a script or something that will shutdown the computer so that these apps won't need to be manually closed. I want to close the programs the friendly way (equivlant of pushing the x or doing Alt-F4) rather than just doing halt and killing all of them because I want them to save their configuration on exit. How can I do this?
|
Your script should kill(1) each process then issue a shutdown(8) command. Or, is this not what you're after?
Have you noticed that when you hover your mouse over a title, the first line of that post pops up? Thus, it is useful for folk looking through the zero-reply threads if the first line contains some detail. The "Hi;" can come next :) |
Kill and shutdown are all fine and well, but I'm looking more to tell the apps to please close rather than killing them without question. I want the app's exit code to run.
I hadn't noticed that. Thanks for the tip! |
kill <pid> will run the programs exit code. With no arguments, kill is just basically saying to the program "well, it's time to go champ" and the head goes down, he chucks the gloves and walks off (sorry, been watching the boxing on TV :D). Now something like kill -9 <pid> is cutting it's head off which you don't want to do. kill <pid> or killall <app_name> is what you're after :)
|
I started to write a script for that myself when using Openbox. Since I now use IceWM which does that for me (close all apps and let them save configuration files) I do not longer need one.
My idea was to send the kill signal and catch those apps that need further action like saving a file and ask the user for the name to save the file as. I used wmctrl for this (google for it) but I gess you could use the kill command purely for the kill part of this. Notice that there was some kind of bug in the script I didn't solve (and I don't remember it to be honest) -- because it did what I mainly wanted: It sends the X apps an kill command but allows them to give the user "save" dialog as well as an button to allow the shutdown with one click. I hope it helps with your task :) Code:
# send all apps (except aterm and pypanel) the HUP signal |
Quote:
Quote:
Another useful tip is to quote a bit of what you are replying to - even if you think it's obvious (I was stumped for a few seconds before I realised what you were responding to in which bit). If this is just a quicky reply - you can still copy-and-paste the line you want and box it with the bv code. That's how the experienced folk get all those coll effects. Have fun. |
Quote:
|
Quote:
Failing to be informative in the title (and now there is a second chance with the mouse-over preview) runs the risk that someone who wants to help will dismiss the thread and move on to the next one. (Unfortunately, the poster will never learn by this method.) If, however, you mean that you go to the next line (more strongly implied by the context), I'd like to know how to do this without clicking on the title first. (This feature is in the search results pane remember.) |
Quote:
Quote:
Quote:
Quote:
|
Quote:
|
Quote:
|
Quote:
Oh, and thanks to everyone who responded. I forgot to mention that in the last post. :) |
So more puzzle - with mousover, I get to see only the first line of the alt text in a thin yellow box. I've been trying to guess how to get the other lines - the carriage returns are not displayed as a character for me, but as new lines. Same if I view the alt-text in the source.
So, I guess the question gets rephrased: how did you get firefox to show CR's in alt-text as characters? (And thus be able to view the entire preview and not just the first line.) |
Quote:
|
Hmmm... looks like it may be a Fedora/Ubuntu thing - or maybe it is the firefox version?
The firefow I got in front of me now is the fedora distro version: 1.0.7-1.1.fc4 (i386) ... Ubuntu also has 1.0.7 ... these are both regularily updated from the distro repositories. The latest version in the fedora yum repo is: 1.0.7-1.2.fc4 for eg. I wonder if it would be worth updating to fx 1.5 ... but surely these patch versions work out very close? (If this goes much further, I'll take it to another thread so everyone can play.) |
All times are GMT -5. The time now is 02:19 AM. |