#!/bin/bash
#
# /etc/init.d/xendomains
# Wrapper to start / stop domains automatically when domain 0 boots / shuts down
#
# chkconfig: 345 99 00
# description: Helper to start / stop Xen domains.
#
# This script is a wrapper init helper for the real workload horse script.
# It should work on LSB-compliant systems.
#
### BEGIN INIT INFO
# Provides:          xendomains
# Required-Start:    $syslog $remote_fs xenstored xenconsoled
# Should-Start:      xend
# Required-Stop:     $syslog $remote_fs xenstored xenconsoled
# Should-Stop:       xend
# Default-Start:     2 3 5
# Default-Stop:      0 1 6
# Short-Description: Wrapper to start/stop secondary xen domains
# Description:       Wrapper for starting / stopping domains automatically
#                    when domain 0 boots / shuts down on systems using init.
#                    The $LIBEXEC_BIN/xendomains helper is shared between init and
#                    systemd systems.
### END INIT INFO

. @XEN_SCRIPT_DIR@/hotplugpath.sh

case "$1" in
    start)
	$LIBEXEC_BIN/xendomains start
	;;
    stop)
	$LIBEXEC_BIN/xendomains stop
	;;
    restart)
	$LIBEXEC_BIN/xendomains restart
	;;
    reload)
	$LIBEXEC_BIN/xendomains reload
	;;
    status)
	$LIBEXEC_BIN/xendomains status
	;;
    *)
	echo "Usage: $0 {start|stop|restart|reload|status}"
	exit 3
	;;
esac
exit $?
