#!/bin/bash # # xend Script to start and stop the Xen control daemon. # # Author: Keir Fraser # # chkconfig: 2345 98 01 # description: Starts and stops the Xen control daemon. ### BEGIN INIT INFO # Provides: xend # Required-Start: $syslog $remote_fs # Should-Start: # Required-Stop: $syslog $remote_fs # Should-Stop: # Default-Start: 3 4 5 # Default-Stop: 0 1 2 6 # Default-Enabled: yes # Short-Description: Start/stop xend # Description: Starts and stops the Xen control daemon. ### END INIT INFO # Source function library. . /etc/rc.d/init.d/functions if [ ! -d /proc/xen ]; then exit 0 fi if ! grep -q "control_d" /proc/xen/capabilities ; then exit 0 fi # Default config params start() { echo -n $"Starting xend daemon: " /usr/sbin/xend RETVAL=$? test $RETVAL = 0 && echo_success || echo_failure echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/xend } stop() { echo -n $"Stopping xend daemon: " killproc xend > /dev/null RETVAL=$? test $RETVAL = 0 && echo_success || echo_failure echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/xend } rcstatus() { status xend RETVAL=$? test $RETVAL = 0 && echo_success || echo_failure echo } reload() { echo -n $"Reloading xend daemon: " killproc xend -HUP > /dev/null RETVAL=$? test $RETVAL = 0 && echo_success || echo_failure echo } RETVAL=0 case "$1" in start) start ;; stop) stop ;; status) rcstatus ;; reload) reload ;; restart|force-reload) stop start ;; condrestart) if [ -f /var/lock/subsys/xend ] then stop start fi ;; *) echo $"Usage: $0 {start|stop|status|restart|condrestart|reload|force-reload}" exit 1 esac exit $RETVAL