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”

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.