Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
To all the closers: this is a reasonable question: How can I shut down a machine remotely? It's just worded differently. –  Mark Henderson Nov 29 '10 at 21:17
    
@Mark exactly i was referring to shutdown remotely, thanks for ur answer. But i can't vote it as best answer with my current reputation. –  SuperMan Nov 29 '10 at 21:22
    
@cool - no worries. You can always give it the green tick mark if you really want (I think you'll have to wait a few minutes though) –  Mark Henderson Nov 29 '10 at 21:26
    
@mark can u please take a look another question posted : serverfault.com/questions/207149/…. Can ur please gimme u ideas on this ? –  SuperMan Nov 29 '10 at 21:34
    
@cool - unfortunately I don't work in a field where I can answer your other question. I will leave a comment on it though as it probably needs more detail. –  Mark Henderson Nov 29 '10 at 21:41
show 1 more comment

4 Answers

up vote 8 down vote accepted

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).

share|improve this answer
1  
Add to the vmware and other appropriate virtualization options: kill the virtual machine process as root from the host OS (not clean). Also add: Disconnect various physical components while the system is running, e.g. hard drive power/data, RAM, fans (also not clean). –  Slartibartfast Nov 30 '10 at 6:23
    
Thanks Slartibartfast! Will disconnecting the fans provide a "guaranteed kill"? –  Jed Daniels Nov 30 '10 at 15:38
    
For VirtualBox you can close the Host's window, where you will get an option to Power Off –  Rich Nov 30 '10 at 16:02
    
Thanks Rich! Added. –  Jed Daniels Nov 30 '10 at 16:27
    
Don't forget "kill -9 1" on most unixoid systems (read that as "it has worked to shut the system down on all I've tried it on", but I admit I havent tried it for QUITE a few years). –  Vatine Dec 2 '10 at 14:00
add comment

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.

share|improve this answer
add comment
  • 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.

share|improve this answer
1  
+1 For pull the plug. Nothing like a volume consistency check on the next boot! :) –  jscott Nov 29 '10 at 21:18
add comment
halt
init 0
shutdown -h now

are three you can run on the shell

share|improve this answer
    
Edited to change shutdown -r to shutdown -h. He didn't want to reboot –  James Lawrie Nov 29 '10 at 21:18
    
Seems you have missed "poweroff" command (actually link to halt) but it is more self explaining (for me) than halt. –  ntk Nov 30 '10 at 8:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.