1#!/bin/sh 2# 3# xendriverdomain Script to start services needed in a Xen driver domain 4# 5# NOTE: This initscript is not needed on dom0. 6 7# chkconfig: 2345 70 10 8# description: Starts and stops xen driver domain daemon 9### BEGIN INIT INFO 10# Provides: xendevd 11# Required-Start: $syslog $remote_fs 12# Should-Start: 13# Required-Stop: $syslog $remote_fs 14# Should-Stop: 15# Default-Start: 2 3 5 16# Default-Stop: 0 1 6 17# Short-Description: Start/stop xen driver domain daemon 18# Description: Starts and stops the daemons neeeded for a xen driver domain 19### END INIT INFO 20 21. @XEN_SCRIPT_DIR@/hotplugpath.sh 22 23xendriverdomain_config=@CONFIG_DIR@/@CONFIG_LEAF_DIR@ 24 25test -f $xendriverdomain_config/xendriverdomain && . $xendriverdomain_config/xendriverdomain 26 27XLDEVD_PIDFILE=@XEN_RUN_DIR@/xldevd.pid 28 29# not running in Xen dom0 or domU 30if ! test -d /proc/xen ; then 31 exit 0 32fi 33 34# mount xenfs in dom0 or domU with a pv_ops kernel 35if test "x$1" = xstart && \ 36 ! test -f /proc/xen/capabilities && \ 37 ! grep '^xenfs ' /proc/mounts >/dev/null; 38then 39 mount -t xenfs xenfs /proc/xen 40fi 41 42# run this script only in domU: 43# no capabilities file in xenlinux domU kernel 44# empty capabilities file in pv_ops domU kernel 45if ! test -f /proc/xen/capabilities || \ 46 grep -q "control_d" /proc/xen/capabilities ; then 47 exit 0 48fi 49 50do_start () { 51 echo Starting xl devd... 52 ${sbindir}/xl devd --pidfile=$XLDEVD_PIDFILE $XLDEVD_ARGS 53} 54do_stop () { 55 echo Stopping xl devd... 56 if read 2>/dev/null <$XLDEVD_PIDFILE pid; then 57 kill $pid 58 while kill -9 $pid >/dev/null 2>&1; do sleep 1; done 59 rm -f $XLDEVD_PIDFILE 60 fi 61} 62 63case "$1" in 64 start) 65 do_start 66 ;; 67 stop) 68 do_stop 69 ;; 70 reload) 71 echo >&2 'Reload not available; use force-reload'; exit 1 72 ;; 73 force-reload|restart) 74 do_stop 75 do_start 76 ;; 77 *) 78 # do not advertise unreasonable commands that there is no reason 79 # to use with this device 80 echo $"Usage: $0 {start|stop|restart|force-reload}" 81 exit 1 82esac 83 84exit $? 85