cloudstack/agent/distro/ubuntu/SYSCONFDIR/init/cloud-cleanup.conf

16 lines
402 B
Plaintext

description "Stop CloudStack VMs on shutdown"
author "Manuel Amador (Rudd-O) <manuel@vmops.com>"
start on stopping libvirt-bin
task
script
curr_runlevel=`runlevel | tail -c 2`
if [ "$curr_runlevel" = "6" -o "$curr_runlevel" = "0" ] ; then
for a in `virsh list | awk ' /^ +[0-9]+ [vri]-([0-9]+?)-/ { print $2 } '` ; do
echo Destroying CloudStack VM $a
virsh destroy $a
done
fi
end script