Commit d4cd9544 authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Add -noreboot option and when inside a XEN vm, use halt instead

of reboot since otherwise the domU just reboots and keeps running.
parent e2a45a1d
#!/bin/sh
. /etc/emulab/paths.sh
#
# XEN vms will just restart, so halt to really stop it.
# Luckily, OpenVZ VMs respect halt as well, so we can always halt
# inside of VMs.
#
dohalt=0
if [ -e "$BOOTDIR/vmname" ]; then
dohalt=1
fi
reboot=1
if [ $# -eq 1 ]; then
if [ "$1" = "-noreboot" ]; then
reboot=0
fi
fi
#
# Arrange for "prepare" to be run on the way down.
#
......@@ -17,13 +36,11 @@ if [ -x /bin/systemd ]; then
systemctl start tbprepare.service
fi
reboot=1
if [ $# -eq 1 ]; then
if [ "$1" = "-noreboot" ]; then
reboot=0
fi
fi
if [ $reboot -eq 1 ]; then
/sbin/reboot
if [ $dohalt -eq 1 ]; then
/sbin/halt
else
/sbin/reboot
fi
fi
exit 0
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment