3
# /etc/init.d/xendomains
4
# Start / stop domains automatically when domain 0 boots / shuts down.
7
# description: Start / stop Xen domains.
9
# This script offers fairly basic functionality.
11
# Based on the example in the "Designing High Quality Integrated Linux
12
# Applications HOWTO" by Avi Alkalay
13
# <http://www.tldp.org/HOWTO/HighQuality-Apps-HOWTO/>
23
if [ $RETVAL -eq 0 ]; then
33
if [ -f /var/lock/subsys/xendomains ]; then return; fi
35
echo -n $"Starting auto Xen domains:"
37
# we expect config scripts for auto starting domains to be in
38
# /etc/xc/auto/ - they could just be symlinks to files elsewhere
39
if [ $(ls /etc/xc/auto/ | wc -l) -gt 0 ]; then
41
# create all domains with config files in /etc/xc/auto
42
for dom in /etc/xc/auto/*; do
43
xc_dom_create.py -q -f $dom
50
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/xendomains
57
# NB. this shuts down ALL Xen domains (politely), not just the ones in
59
# This is because it's easier to do ;-) but arguably if this script is run
60
# on system shutdown then it's also the right thing to do.
62
echo -n $"Shutting down all Xen domains:"
64
if [ $(ls /var/run/xendomains/ | wc -l) -gt 0 ]; then
66
cd /var/run/xendomains/
70
kill -s SIGTERM $(cat $pid)
78
xc_dom_control.py shutdown all -w # shut down all domains, politely and wait
83
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/xendomains
88
# This does NOT necessarily restart all running domains: instead it
89
# stops all running domains and then boots all the domains specified in
90
# /etc/xc/auto. If other domains have been started manually then they will
92
# Commented out to avoid confusion!
100
# same as restart for now - commented out to avoid confusion
116
# The following are commented out to disable them by default to avoid confusion
117
# - see the notes above
128
xc_dom_control.py list
132
echo $"Usage: $0 {start|stop|status}"