when a user presses the shutdown form the menu which process or file is called in return of this to shutdown the mac os

also the directory path of the process

regards.

link|improve this question

75% accept rate
1  
I'm guessing the shutdown process is called at some extent, but I'm wondering why you're asking this question in the first place? – Randolph West Jan 28 '11 at 8:02
i need to call this process with some other source instead off shutdown menu button – moon Jan 28 '11 at 9:19
It would be useful if you edited your question to instead ask "how can I invoke Mac OS X shutdown programmatically". – Daniel Beck Jan 28 '11 at 17:49
feedback

2 Answers

up vote 2 down vote accepted

Execute from the command line, or call osascript some other way with these arguments.

osascript -e 'tell application "Finder" to shut down'

Apple has a Technical Q&A about programmatically restarting, shutting down, or logout. (Thanks @NSGod)

link|improve this answer
This is like the normal GUI-induced shutdown, e.g. canceling the prompt for unsaved documents will cancel shutdown. According to your question, this is the behavior you want. If not, shutdown -h now. – Daniel Beck Jan 28 '11 at 9:38
thanx it is absolutely the thing i required – moon Jan 28 '11 at 15:15
3  
Technically, telling the Finder to do this is deprecated; you should use System Events instead. That said, the end result of either method is basically kAERestart being sent to kSystemProcess (loginwindow). – NSGod Jan 28 '11 at 20:11
@NSGod Well, it's part of the Legacy Suite, but I didn't find deprecation mentioned in the ASE Library. And it's shorter to type than System Events. – Daniel Beck Jan 28 '11 at 20:13
feedback

sudo halt or sudo reboot also work. Read halt(8). AFAIK you'll have to be root because the /sbin/ directory where those programs reside isn't (shouldn't be) in your PATH by default.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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