34 lines
603 B
Bash
Executable File
34 lines
603 B
Bash
Executable File
#!/bin/sh
|
|
|
|
VMSW=KVM
|
|
if [ -n "$USE_LXC" ]; then
|
|
VMSW=LXC
|
|
elif [ -n "$USE_VBOX" ]; then
|
|
VMSW=VBOX
|
|
fi
|
|
|
|
case $VMSW in
|
|
KVM)
|
|
if [ ! -e var/target.pid ]; then exit; fi
|
|
|
|
on-target -u root halt
|
|
sleep 5
|
|
|
|
if [ ! -e var/target.pid ]; then exit; fi
|
|
sleep 5
|
|
|
|
if [ ! -e var/target.pid ]; then exit; fi
|
|
|
|
echo Killing target since it did not shutdown within 10 seconds
|
|
kill `cat var/target.pid`
|
|
;;
|
|
LXC)
|
|
true
|
|
;;
|
|
VBOX)
|
|
if [ ! -e var/target.vmname ]; then exit; fi
|
|
VBoxManage controlvm `cat var/target.vmname` savestate
|
|
rm var/target.vmname
|
|
;;
|
|
esac
|