HOWTO Remove Shut Down Warning?

bobw

The Late: SuperMacMod
Remove Shut Down Warning


do shell script "sudo shutdown -h now" password "yourAdminPassword" with administrator privileges
 
I am curious about what shutdown warning you are eliminating. This will certainly bring the machine down but I don't think that it will post the correct termination notifications to running applications to save there data. There will also not be any way for an application to cancel the shutdown for some reason.

Just wonderin'

-Eric
 
This is just for the shutdown warning you get when you shutdown your machine. After doing this in Terminal, the warning will no longer appear when you shut down. I've seen people ask how this warning can be eliminated.
 
you can also hold down control + option + command and press the eject button on your keyboard. You'll be shut down automatically with no prompt.
 
bobw said:
Remove Shut Down Warning


do shell script "sudo shutdown -h now" password "yourAdminPassword" with administrator privileges
You should never put your password in any cleartext file...especially not an executable script... even if you lock down the permissions.

You shoud consider chaning the subject of this to "How NOT To" so it does not come up in search results with the other how to posts.
 
As far as I understand this, it is not written in a file, just in Terminal.

It probably edits some settings (that are saved in a administrator only file).
 
My impression was that this was a "shell scrit" that would be run every time.

If it's a one time thing that sets a setting, then fine. but then I would not call it a "shell script". I'd call it a shell command.

But then again, the "do shell script" thing makes me wonder if this is an AppleScrript... If so, I'm not sure how "encrypted" the compiled AppleScript programs are. Still does not seem like a prudent place to hard code a password.
 
Just to point out that using shutdown is very heavy handed and can cause data loss. The normal way of shutting down sends a notification to all running programs and gives them a chance to prompt you to save your files. If you do not respond then the application can cancel the termination until you can address the issue. Using shutdown sends all processes a terminate signal followed by a kill signal some number of seconds later (5 I think ). That means if you forgot to save your Word document it is just gone.

It just doesn't strike me as a bright thing to do. I don't shut down often, but whenever I do, I usually am prompted to save something that I would have regretted losing.
 
BobW, maybe you could clear this up for me, too... It looks like AppleScript. Are users supposed to type what you wrote into an AppleScript and run that once? Or does this go into the Terminal directly? "sudo shutdown -h now" in Terminal just shuts down the computer, afaik. It doesn't write this anywhere in system code so the warning message doesn't reappear after choosing 'Shutdown' from the Apple menu, or does it?
 
Goes in Terminal, but I don't know if it works in 10.3. Did work in 10.2. Haven't tried.
 
...sudo shutdown -h now in Terminal just shuts down the computer, afaik. It doesn't write this anywhere in system code so the warning message doesn't reappear after choosing 'Shutdown' from the Apple menu, or does it?
You are correct - it only shuts down the machine,
and it does not remove future shutdown warnings.
You would have to run it every time you wanted to
shut down. It is also not a good idea because it
does not allow the machine to shut down gracefully
- i.e. sending termination signals to all open processes.
 
Thanks for explaining this. I'm moving the thread to System & Software. Maybe someone can still find a solution for the original problem, i.e. that a user wants the shutdown warning removed...
 
bobw it does indeed work in Panther.

g/re/p though, I'm not fully versed on the workings of shutdown(8) but I think it is a (somewhat) graceful termination. No, it won't prompt the user at con to save work but it does give the shutdown blue screen and gear which tells me it must be talking to Aqua. This means it mustn't be just sending signal 9 to every running process or else the screen would just go black (or switch to a "verbose" console).

I could always be wrong though, this is just a deduction.
 
michaelsanford said:
This means it mustn't be just sending signal 9 to every running process or else the screen would just go black (or switch to a "verbose" console).

I could always be wrong though, this is just a deduction.

I guess my explanation above was to obtuse and you missed it. Shutdown first sends every process a TERM (terminate) signal. This signal is a polite request for that program to exit on its own, it is designed to allow for things like automatically syncing files and saving data. After a number of seconds shutdown then sends a KILL (signal 9) to every process which is still hanging around.

I am sure that the window server (or whatever) catches the TERM signal and tries to shut down as nicely as possible. But if it does not run fast enough it will be summarily executed just like any other process.

-Eric
 
Back
Top