0

I would like to shutdown a VM which is running Ubuntu 12.04LTS, and bring it up again after 5 mins.

Can this be done using command line ?

2
  • 1
    That depends on the host OS running the VM.
    – muru
    Jul 26, 2014 at 20:57
  • Procedures and commands considerably depend on the host OS, and the virtualization software used. Please edit your question for this information. To give you a good answer we also need to know whether (and eventually why) your guest Ubuntu needs to shutdown/reboot, or if pausing it was good enough too.
    – Takkat
    Jul 26, 2014 at 21:06

1 Answer 1

1

This answer is for ubuntu. It won't run if your host os is Windows (as muru said).

I would suggest:

watch -n 300 <yourvmcommand> && sleep 300 && pkill <yourvmprocessname>

The watch command will repeat every 300 secs the following:

  1. Start the vm. If it started successfully then:

  2. Wait 300 seconds. If it did wait 300 seconds then:

  3. Kill the vm

Then watch takes over and will wait the 300 secs, then launch it again.

2
  • Thank you for reply. Actually I am doing this experiment on GENI resources. I dont have a control access to the resource. Only i can do is ssh. When i issue the command " sudo reboot" it reboots and comes up 30secs. What I want is "sudo reboot" command should take longer time to come up say 5mins.
    – navaz
    Jul 26, 2014 at 21:28
  • so what about sudo shutdown 5?
    – Tim
    Jul 26, 2014 at 21:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .