+++ /dev/null
-#!/bin/sh
-#
-# xend Script to start and stop the Xen control daemon.
-#
-# Author: Keir Fraser <keir.fraser@cl.cam.ac.uk>
-#
-# chkconfig: 2345 98 01
-# description: Starts and stops the Xen control daemon.
-
-# Source function library
-. /etc/rc.d/init.d/functions
-
-if ! [ -e /proc/xen/privcmd ]; then
- exit 0
-fi
-
-await_daemons_up()
-{
- retval=$1
- i=1
- rets=10
- /usr/sbin/xend status
- while [ $? -ne 0 -a $i -lt $rets ]; do
- sleep 1
- i=$(($i + 1))
- /usr/sbin/xend status > /dev/null 2>&1
- done
-}
-
-start() {
- if [ ! -f /var/lock/subsys/xend ]; then
- msg_starting Xend
- daemon /usr/sbin/xend start
- RETVAL=$?
- await_daemons_up
- [ $RETVAL -eq 0 ] && touch /var/lock/subsys/xend
- else
- msg_already_running Xend
- fi
-}
-
-stop() {
- if [ -f /var/lock/subsys/xend ]; then
- msg_stopping Xend
- daemon /usr/sbin/xend stop
- rm -f /var/lock/subsys/xend >/dev/null 2>&1
- else
- msg_not_running Xend
- fi
-}
-
-condrestart() {
- if [ -f /var/lock/subsys/xend ]; then
- stop
- start
- else
- msg_not_running Xend
- RETVAL=$1
- fi
-}
-
-RETVAL=0
-case "$1" in
- start)
- start
- ;;
- stop)
- stop
- ;;
- restart)
- stop
- start
- ;;
- try-restart)
- condrestart 0
- ;;
- force-reload)
- condrestart 7
- ;;
- status)
- /usr/sbin/xend status
- ;;
- *)
- msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
- exit 3
-esac
-
-exit $RETVAL
+++ /dev/null
-#!/bin/sh
-#
-# /etc/init.d/xendomains
-# Start / stop domains automatically when domain 0 boots / shuts down.
-#
-# chkconfig: 345 99 00
-# description: Start / stop Xen domains.
-#
-# This script offers fairly basic functionality. It should work on Redhat
-# but also on LSB-compliant SuSE releases and on Debian with the LSB package
-# installed. (LSB is the Linux Standard Base)
-#
-# Based on the example in the "Designing High Quality Integrated Linux
-# Applications HOWTO" by Avi Alkalay
-# <http://www.tldp.org/HOWTO/HighQuality-Apps-HOWTO/>
-#
-### BEGIN INIT INFO
-# Provides: xendomains
-# Required-Start: $syslog $remote_fs xend
-# Should-Start:
-# Required-Stop: $syslog $remote_fs xend
-# Should-Stop:
-# Default-Start: 3 4 5
-# Default-Stop: 0 1 2 6
-# Short-Description: Start/stop secondary xen domains
-# Description: Start / stop domains automatically when domain 0
-# boots / shuts down.
-### END INIT INFO
-
-if ! [ -e /proc/xen/privcmd ]; then
- exit 0
-fi
-
-RETVAL=0
-
-INITD=/etc/init.d
-
-AUTODIR=/etc/xen/auto
-LOCKFILE=/var/lock/subsys/xendomains
-
-if [ -e /lib/lsb ]; then
- # assume an LSB-compliant distro (Debian with LSB package,
- # recent-enough SuSE, others...)
-
- . /lib/lsb/init-functions # source LSB standard functions
-
- on_fn_exit()
- {
- if [ $RETVAL -eq 0 ]; then
- log_success_msg
- else
- log_failure_msg
- fi
- }
-elif [ -r $INITD/functions ]; then
- # assume a Redhat-like distro
- . $INITD/functions # source Redhat functions
-
- on_fn_exit()
- {
- if [ $RETVAL -eq 0 ]; then
- ok
- else
- fail
- fi
-
- echo
- }
-else
- # none of the above
- LOCKFILE=/var/lock/xendomains
-
- on_fn_exit()
- {
- echo
- }
-fi
-
-
-
-start() {
- if [ -f $LOCKFILE ]; then return; fi
-
- echo -n $"Starting auto Xen domains:"
-
- # We expect config scripts for auto starting domains to be in
- # AUTODIR - they could just be symlinks to files elsewhere
- if [ -d $AUTODIR ] && [ $(ls $AUTODIR | wc -l) -gt 0 ]; then
- touch $LOCKFILE
-
- # Create all domains with config files in AUTODIR.
- for dom in $AUTODIR/*; do
- xm create --quiet --defconfig $dom
- if [ $? -ne 0 ]; then
- RETVAL=$?
- fi
- done
-
- fi
-
- on_fn_exit
-}
-
-stop()
-{
- # NB. this shuts down ALL Xen domains (politely), not just the ones in
- # AUTODIR/*
- # This is because it's easier to do ;-) but arguably if this script is run
- # on system shutdown then it's also the right thing to do.
-
- echo -n $"Shutting down all Xen domains:"
-
- xm shutdown --all --wait --halt
-
- RETVAL=$?
-
- [ $RETVAL -eq 0 ] && rm -f $LOCKFILE
-
- on_fn_exit
-}
-
-# This does NOT necessarily restart all running domains: instead it
-# stops all running domains and then boots all the domains specified in
-# AUTODIR. If other domains have been started manually then they will
-# not get restarted.
-# Commented out to avoid confusion!
-#
-#restart()
-#{
-# stop
-# start
-#}
-
-# same as restart for now - commented out to avoid confusion
-#reload()
-#{
-# restart
-#}
-
-
-case "$1" in
- start)
- start
- ;;
-
- stop)
- stop
- ;;
-
-# The following are commented out to disable them by default to avoid confusion
-# - see the notes above
-#
-# restart)
-# restart
-# ;;
-#
-# reload)
-# reload
-# ;;
-
- status)
- xm list
- ;;
-
- *)
- echo $"Usage: $0 {start|stop|status}"
- ;;
-esac
-
-exit $RETVAL