0

Is this correct command to shutdown Leopard after 60min?

sudo shutdown -h 60

Chealion
  • 5,713
  • 27
  • 29
user41999
  • 117
  • 1
  • 6

1 Answers1

4

The correct usage from the command line for shutting down Mac OS after 60 minutes is:

sudo shutdown -h +60

That is not the method that Apple recommends using, though it is probably the best way on a headless server. (Update: See comment and link from @radius - the use of shutdown is recommended by Apple's server CLI admin guide). From the Command Line Junkies Guide to Mac OS X (the site is out of date but the reference to using osascript is current):

Rebooting and Shutting Down

Although you can reboot or shut down Mac OS X systems via the traditional halt, reboot and shutdown commands, the Apple-recommended way of turning off the computer remotely is to send the Finder an Apple Event. This can be accomplished using the osascript command to run an AppleScript:

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

or

osascript -e 'tell application "Finder" to restart'

Of course, this will only work if there's a user logged in, which will typically not be the case with, say, headless servers, in which case you should be able to use traditional UNIX commands without negative consequences.

runlevelsix
  • 2,609
  • 21
  • 19
  • 1
    Apple server CLI admin guide (http://images.apple.com/server/macosx/docs/Command_Line_Admin_v10.5.pdf) recommand shutdown/restart commands, so it's totaly OK – radius Aug 16 '10 at 15:11
  • +1 Thanks @radius - updated my post. – runlevelsix Aug 16 '10 at 15:27
  • 2
    The problem with the shutdown approach is that it kills all running GUI apps, without the option to save the data like with the osascript approach. On a server, this should be OK, but on a workstation, it might be a problem. Still, I use shutdown most of the time, because it is way faster if you have many applications open. – Sven Aug 16 '10 at 15:32