Mac OS X Leopard: Shutdown Command

mac-osxosx-leopard

Is this correct command to shutdown Leopard after 60min?

sudo shutdown -h 60

Best Answer

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.