diff -rup xen-3.0.5-testing.hg-rc3-14934/tools/examples/init.d/xend xen-3.0.5-testing.hg-rc3-14934.new/tools/examples/init.d/xend
--- xen-3.0.5-testing.hg-rc3-14934/tools/examples/init.d/xend 2007-04-26 19:31:46.000000000 -0400
+++ xen-3.0.5-testing.hg-rc3-14934.new/tools/examples/init.d/xend 2007-04-26 19:32:47.000000000 -0400
@@ -7,40 +7,66 @@
# chkconfig: 2345 98 01
# description: Starts and stops the Xen control daemon.
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+RETVAL=0
+if [ ! -d /proc/xen ]; then
+ exit 0
+fi
if ! grep -q "control_d" /proc/xen/capabilities ; then
exit 0
fi
+prog=xend
# Wait for Xend to be up
function await_daemons_up
{
i=1
rets=10
- xend status
+ /usr/sbin/xend status
while [ $? -ne 0 -a $i -lt $rets ]; do
sleep 1
echo -n .
i=$(($i + 1))
- xend status
+ /usr/sbin/xend status
done
+ if [ $i -ge $rets ]; then
+ RETVAL=-1
+ return 1
+ fi
+ return 0
}
case "$1" in
start)
- xend start
+ echo -n $"Starting $prog: "
+ modprobe blkbk 2>/dev/null
+ modprobe blktap 2>/dev/null
+ modprobe xenblktap 2>/dev/null
+ modprobe netbk 2>/dev/null
+ /usr/sbin/xend start
await_daemons_up
;;
stop)
- xend stop
+ echo -n $"Stopping $prog: "
+ /usr/sbin/xend stop
+ RETVAL=$?
;;
status)
- xend status
+ /usr/sbin/xend status
+ if [ $? = 0 ] ; then
+ echo -n $"$prog is running"
+ else
+ echo -n $"$prog is stopped"
+ RETVAL=3
+ fi
;;
reload)
- xend reload
+ /usr/sbin/xend reload
;;
restart|force-reload)
- xend restart
+ /usr/sbin/xend restart
await_daemons_up
;;
*)
@@ -50,5 +76,12 @@ case "$1" in
exit 1
esac
-exit $?
+if [ $RETVAL = 0 ] ; then
+ echo_success
+ echo
+else
+ echo_failure
+ echo
+fi
+exit $RETVAL