Initiating shutdown prompt from terminal

Discussion in 'macOS' started by Apocrathia, Jul 19, 2009.

  1. Apocrathia macrumors 6502

    Joined:
    Jan 6, 2009
    Location:
    University of South Alabama
    #1
    That little prompt you get when you go through the apple menu at the top left and hit shut down. It gives you 60 seconds, etc...
    I want to know how to initiate that from the terminal. I keep apcupsd running on my mac mini server, and if the power goes out, i want it to tell my machines to shut down. I already have a growl message setup letting me know when the power goes out (forwarded to my iphone over prowl, etc etc). I can ssh into the systems via bash scripting and issue the command, that's np. I just have no idea wtf the command is to throw that prompt.
    Anyone have any ideas?
     
  2. LtRammstein macrumors 6502a

    LtRammstein

    Joined:
    Jun 20, 2006
    Location:
    Denver, CO
    #2
    You can make an Applescript to do that. Just make sure to do a DisplayDialog and shell scripting. In Terminal.app you can type: shutdown -r now (restart), etc.
     
  3. Compile 'em all macrumors 601

    Compile 'em all

    Joined:
    Apr 6, 2005
    #3
    In linux I used to use halt but I didn't try it on os x.
     
  4. gr8tfly macrumors 603

    gr8tfly

    Joined:
    Oct 29, 2006
    Location:
    ~119W 34N
    #4
    man "shutdown"

    You can give a specific time or number of minutes prior to shutdown, or use "now".
     
  5. Apocrathia thread starter macrumors 6502

    Joined:
    Jan 6, 2009
    Location:
    University of South Alabama
    #5
    halt and shutdown always work, but i want to find something that will display a message. The applescript idea seems to be a good route, the question is how do i execute applescript from within a bash script. I still haven't even really touched applescript before. I've heard it's a pretty simple language.
     

Share This Page