#!/usr/bin/bash
#
# Reboot a VM.
# Copyright (c) 2016 Joyent Inc., All rights reserved.

export LANG=C
PATH="/opt/local/bin:/opt/local/gnu/bin:/opt/local/sbin:/usr/bin:/usr/sbin";

# Un-mount NFS filesystems first.
for i in $(df -F nfs 2>/dev/null | egrep -v "^Filesystem" | awk '{ print $1 }'); do 
	umount $i;
done

# Shut down.
shutdown -y -i6 -g0
