#!/bin/sh

if [ -f /usr/local/etc/emulab/rc/rc.testbed ]; then
    /usr/local/etc/emulab/rc/rc.testbed start
    if [ ! $? -eq 0 ]; then
	echo "Failed to start /usr/local/etc/emulab/rc/rc.testbed: $?"
	exit $?
    fi
    #
    # runit expects the run file to continue execution until death.
    #
    while [ 1 -eq 1 ]; do
        sleep 60
    done
else
    sv down testbed
fi

exit 0
