One user consulted about the ability to set a timed shutdown for a Mac. In fact, OS X system comes with this related function, but "hidden" a bit deep. Here to share with you:
Open System Preferences-Energy saver, then click on the "Timing" button;
Tick the second check box (the one in front of sleep) and select Shut Down/restart/sleep in the dropdown menu;
Set the time on the right.
Note: The above methods are tested under OS X Mountain Lion 10.8 System, and other versions of OS X systems may be slightly different.
However, this can only be done by setting the periodic loop. That is, there is no way to set "execute only once". If you want to set a timed shutdown/restart/sleep only once in a while, you can use terminal commands to resolve it. Here are some examples:
Set September 5, 2012 23:15 minute shutdown: sudo shutdown-h 1209052315
Set September 5, 2012 23:15 min Restart: sudo shutdown-r 1209052315
Set September 5, 2012 23:15 min sleep: sudo shutdown-s 1209052315
I believe we all understand, the main body of the command is SHUTDOWN,H/R/S respectively represents shutdown/restart/sleep, and then add the execution time (YYMMDDHHMM) can be followed.
Some fans may still have a problem: what if I want to temporarily cancel my scheduled shutdown/sleep/restart? It is also very simple, and it is illustrated by examples. For example, we executed the command in the terminal for the September 3, 2012 23:15 sub-shutdown, which appears as follows:
mbp:~ $ sudo shutdown-h 1209052315
Shutdown at Mon Sep 5 23:15:00 2012.
Shutdown: [PID 577]
Note the above PID 577, this refers to the current run of the shutdown command process number, if you want to cancel the shutdown, only need to stop the process of running it. The command is:
sudo kill 577