Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: ca-60540
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

executable file 121 lines (105 sloc) 2.996 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
#! /bin/bash
#
# xapi Start/Stop xen services
#
# chkconfig: 2345 21 78
# description: Xen services required by xapi
# processname: xenstored, xenconsoled
# config: /etc/xensource/rio.conf
# pidfile: /var/run/xenstored.pid, /var/run/xenconsoled.pid

[ -e /proc/xen ] || exit 0

# Source function library.
. /etc/init.d/functions
 
start() {
    # If this domain hasn't got sufficient privileges then assume it is a domU
    # and start the hypercall simulator
    /opt/xensource/bin/list_domains 2>/dev/null 1>/dev/null
    if [ $? -ne 0 ]; then
echo -n $"Starting simulator: "
rm -f /var/xapi/xiu-xc /var/xapi/xiu-xs
/opt/xensource/libexec/xiu /var/xapi/xiu 2>/dev/null 1>/dev/null &

        # wait for unix domain socket to appear
        RETRIES=180
        while [ ${RETRIES} -ne 0 ]; do
[ -e /var/xapi/xiu-xc ] && break
RETRIES=$(( ${RETRIES} - 1 ))
sleep 1
echo -n .
done
if [ -e /var/xapi/xiu-xc ]; then
echo "[ OK ]"
else
failure $"xiu"
exit 1
fi
export XENCTRL_OSDEP=/opt/xensource/lib/libxenctrl_xiu.so
export XIU=/var/xapi/xiu
    fi
echo -n $"Starting xenstored: "
        if [ -e /var/lock/subsys/xen ]; then
if [ -e /var/run/xenstored.pid ] && [ -e /proc/`cat /var/run/xenstored.pid` ]; then
echo -n $"cannot start xenstored: xenstored is already running.";
failure $"cannot start xenstored: xenstored already running.";
echo
return 1
fi
if [ -e /var/run/xenconsoled.pid ] && [ -e /proc/`cat /var/run/xenconsoled.pid` ]; then
echo -n $"cannot start xenconsoled: xenconsoled is already running.";
failure $"cannot start xenconsoled: xenconsoled already running.";
echo
return 1
fi
fi

    # Existence of stampfile suppresses the access log (oem)
    XENSTORED_ARG=""
    [ ! -e /etc/xensource/xenstored-no-access-log ] || XENSTORED_ARG="--no-access-log"
    [ -e /var/lib/xenstored/tdb ] && mv -f /var/lib/xenstored/tdb /var/lib/xenstored/tdb.bak
    /opt/xensource/bin/xenstored ${XENSTORED_ARG}

/usr/sbin/xenconsoled
[ -d /var/log/blktap ] || mkdir /var/log/blktap

# Delete rubbish from xapi's private tree in xenstore, once per boot (not once per
# xapi invocation since the data should be persistent across xapi restarts)
xenstore-rm /xapi

# Delete any accumulated /vm entries, once per boot
xenstore-rm /vm

# start cdrommon on all physicals cdrom at startup
for i in `find /dev/xapi/cd/ ! -type d`; do /opt/xensource/libexec/cdrommon $i; done

echo
touch /var/lock/subsys/xen;
return $RETVAL
}

stop() {
echo -n $"Action not supported"
failure $"Action not supported"
echo
return 1;
}

rhstatus() {
status xapi
}

restart() {
echo -n $"Action not supported"
failure $"Action not supported"
echo
return 1;
}

case "$1" in
  start)
   start
;;
  stop)
   stop
;;
  restart)
   restart
;;
  status)
   rhstatus
;;
  condrestart)
   [ -f /var/lock/subsys/xapi ] && restart || :
;;
  *)
echo $"Usage: $0 {start|stop|status|restart|condrestart}"
exit 1
esac

Something went wrong with that request. Please try again.