Different ways to shut down a system

I was asked this question in an interview for QA position:

Tell me all the possible ways you can shutdown your system. The system could be in a network.

I know this question is little vague. This was question asked by the interviewer, may be he was expecting me to answer with respect to virtualization?

My Answer: use ssh to shutdown different systems in the network.

He was satisfied with this answer, but was expecting me to tell me some other ways.

So, what are other ways of shutting down a system?


What kind of system? Do you have physical access? Does "shutdown" mean clean shutdown? Do you want to power the system down simultaneously?

Here is the list I have so far:

Any OS:

  1. Push the power button (may need to hold down for ~5 seconds) (*may not be clean)
  2. Unplug the power cord from the system (will not be clean)
  3. Cut the power cord (will not be clean)
  4. Unplug the power cord from the UPS, powerstrip, or wall that it is connected to (will not be clean)
  5. Remove critical components from the system (disks, power supply, CPU, RAM) (definitely not clean)
  6. Destroy system with insert your preferred method destruction here (clean doesn't matter, cause you can't recover from this type of shutdown without a time machine)

Windows:

  1. Start -> Shutdown
  2. At command prompt, type shutdown /p /f (you can do shutdown /? for a list of flags, there are lots of choices)
  3. Over the network: shutdown \\machinename /y /c (from Mark Henderson's answer)

Linux:

  1. Choose the shutdown command in your GUI (too dependent on GUI to give specifics here)
  2. shutdown -h now (-h will power it off)
  3. init 0
  4. halt (Ah, this brings back memories of the good old days: sync;sync;halt)
  5. ssh root@machinename shutdown -h now (if you can't ssh as root, then do sudo shutdown ...)

FreeBSD:

  1. shutdown -p now (-p will power it off)
  2. Choose the shutdown command in your GUI (too dependent on GUI to give specifics here)
  3. halt

OSX:

  1. Click the Apple in the task bar -> Shut Down
  2. From Terminal.app -> shutdown -h now

VMware:

  1. Choose appropriate command from above list depending on the guest OS.
  2. Right Click guest, choose Power -> Power Off (or click on it and do CTRL+E)
  3. Right Click guest, choose Power -> Shut Down Guest (or click on it and do CTRL+D)
  4. vmrun -T server -h https://IP-OF-HOST:8333/sdk -u user -p password stop "[datastore] guest.vmx" (this assumes you have vmrun access from a command line)
  5. Kill virtualization process on the host (not clean)

Xen:

  1. Choose appropriate command from above list depending on the guest OS
  2. xm shutdown machinename
  3. Kill virtualization process on the host (not clean)

Virtual Box:

  1. Choose appropriate command from above list depending on the guest OS
  2. Close the Host's window, where you will get an option to Power Off the virtual machine(s)
  3. Kill virtualization process on the host (not clean)

I'm sure there are MANY others, I will add them to my answer as they come to me (or people post them in the comments).


  • Windows: shutdown \\machinename /y /c
  • Xen: xm shutdown machinename or xm destroy machinename
  • VMWare: Log into vSphere management console, right-click machine and choose "shut down"

If the machine has a network-controlled power strip you could log into the power strip and turn the power off.


halt
init 0
shutdown -h now

are three you can run on the shell


I use a LogMeIn to control servers remotely. We've got a small infrastructure and it does the job quite well (and is secure).

If you want to "set it and forget it" then you can use a small program called "Switch Off" which also does well for remote reboots late at night.