Playing with System Shutdown

March 8, 2010, by | Start Discussion

Windows

To shutdown a windows box (remember we aren’t talking pre XP machines) the command line option is “shutdown”

C:> shutdown /?

Usage: shutdown [-i | -l | -s | -r | -a] [-f] [-m\computername] [-t xx] [-c "comment"] [-d up:xx:yy]

No args Display this message (same as -?)

-i      Display GUI interface,        must be the first option
-l      Log off (cannot be used with -m option)
-s      Shutdown the computer
-r      Shutdown and restart the computer
-a      Abort a system shutdown
-m        \computername Remote computer to shutdown/restart/abort
-t        xx   Set timeout for shutdown to xx seconds
-c       "comment"    Shutdown comment (maximum of 127 characters)
-f      Forces running applications to close without warning
-d      [u][p]:xx:yy The reason code for the shutdown
u       is the user code
p       is a planned shutdown code
xx      is the major reason code (positive integer less than 256)
yy      is the minor reason code (positive integer less than 65536)

To simply shutdown a machine

C:> shutdown -s -t 30

-s = shutdown
-t = time to wait
30 = seconds

This command will shutdown the machine in 30 seconds.  The system will show a warning message like the figure blow.

C:> shutdown -s -t 30 –c “This is a shutdown initiated from Command Line”

To Show a message in the dialog box  you  can go ahead with where -c = comments

To restart the machine

C:> shutdown -r -t 30

To log off a machine

C:> shutdown -l -t 30

But most importantly to ABORT a shutdown in progress use
   
C:> shutdown –a

-a = abort
-a switch doesn’t require any more parameter. But remember shutdown –a has to run before lsass.exe or services.exe is terminated.

Pankit Thakkar
[email protected]

Linux

This time the command in Linux is very much similar to Windows.
To shutdown instantaneously
        
# shutdown

To reboot in 1 min

 # shutdown -r +1

To abort the shutdown

 # shutdown -c          

To reboot at a specific time

# shutdown -r 16:30    

Shutdown and reboot at 4:30pm

Author bio not avialable

Leave a Reply