Friday 24 October 2008

Forcing restart in Windows and Linux

Sometimes it becomes necessary to restart a server or other remote system. Windows is especially problematic, as it will often wait on a hung application to end before shutting down.

Thankfully, there is a command to help, the "shutdown" command. If you are remotely logged in, simply open a command prompt (Start -> Run -> type "cmd" -> OK). In the command prompt, enter the following:

shutdown -t 0 -r -f

There are other options (to view them all, type "shutdown --help" into the command prompt); but I will summarise the ones above:
  • -t 0
    • This sets a timeout of zero seconds before shutting down
  • -r
    • This specifies a restart
  • -f
    • Forces all open programs to close immediately
In Linux, things are more immediate:

shutdown now -r

Enter the above command in a terminal window to force an immediate restart.

No comments: