Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use an upstart script to monitor a vm and respawn it when it gets killed. I would like to simulate a failover by doing the following. Create a clone of the VM1 say VM2. When either of them is running , I have the other VM in saved state. As soon as one gets killed , I resume the other and start the killed vm but keep it paused.

How should I modify this single vm script to work for 2 vms or maybe multiple vms even?

start on (local-filesystems and net-device-up IFACE=eth0)
stop on runlevel [016]

console output

respawn limit 5 10

pre-stop script
su pankajm -c “VBoxManage controlvm ubuntu-server savestate”
end script

exec su pankajm -c “VBoxHeadless –startvm ubuntu-server”
share|improve this question

Your Answer


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

Browse other questions tagged or ask your own question.