Blob Blame History Raw
--- xen-unstable-10712/tools/examples/init.d/xend.init	2006-07-21 13:31:22.000000000 -0400
+++ xen-unstable-10712/tools/examples/init.d/xend	2006-08-22 17:23:55.000000000 -0400
@@ -7,37 +7,63 @@
 # 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
+	modprobe netbk
+	modprobe netloop
+	/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 xend is running
+	else
+	    echo xend is stopped
+	fi
+        exit 0
 	;;
   restart|reload|force-reload)
-	xend restart
+        echo -n $"$1 $prog: "
+	/usr/sbin/xend restart
 	await_daemons_up
 	;;
   *)
@@ -47,5 +73,12 @@
 	exit 1
 esac
 
-exit $?
+if [ $RETVAL = 0 ] ; then
+    echo_success
+    echo
+else
+    echo_failure
+    echo
+fi
+exit $RETVAL