Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
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? –  user3463 Jan 28 '11 at 8:02
    
i need to call this process with some other source instead off shutdown menu button –  Badr uz Zaman 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

2 Answers 2

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)

share|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 –  Badr uz Zaman 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

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.

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.