Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: ca-70188
Fetching contributors…

Cannot retrieve contributors at this time

107 lines (89 sloc) 1.873 kb
#! /bin/bash
#
# xenopsd Start/Stop the xenops daemon
#
# chkconfig: 2345 22 77
# description: xenops daemon
# processname: xenopsd
# pidfile: /var/run/xenopsd.pid
# Source function library.
. /etc/init.d/functions
NAME="xenopsd"
# location of the executable:
BIN="@OPTDIR@/libexec/$NAME"
# pidfile:
PID_FILE="/var/run/$NAME.pid"
# lock file
SUBSYS_FILE="/var/lock/subsys/$NAME"
# Source function library.
. /etc/init.d/functions
# Enable core dumping
ulimit -c unlimited
start() {
echo -n $"Starting the $NAME daemon: "
# Set domain 0's uuid to the correct value
. @INVENTORY@
@OPTDIR@/libexec/domain_sethandle -domid 0 -handle "${CONTROL_DOMAIN_UUID}"
if [ -e ${SUBSYS_FILE} ]; then
if [ -e ${PID_FILE} ] && [ -e /proc/`cat ${PID_FILE}` ]; then
echo -n $"cannot start $NAME: already running."
failure $"cannot start $NAME: already running."
echo
return 1
fi
fi
${BIN} -daemon -config /etc/xenopsd.conf >/dev/null 2>&1 </dev/null
MAX_RETRIES=30
RETRY=0
while [ ${RETRY} -lt ${MAX_RETRIES} ]; do
PID=$(cat ${PID_FILE} 2>/dev/null)
kill -0 ${PID} 2> /dev/null
if [ $? -eq 0 ]; then
touch ${SUBSYS_FILE}
success
echo
return 0
fi
sleep 1
echo -n .
RETRY=$(( ${RETRY} + 1 ))
done
echo -n $"failed to start $NAME."
failure $"failed to start $NAME."
killproc $NAME
rm -f ${SUBSYS_FILE} ${PID_FILE}
echo
return 1
}
stop() {
echo -n $"Stopping the $NAME daemon: "
if [ ! -e ${SUBSYS_FILE} ]; then
echo -n $"cannot stop $NAME: $NAME is not running."
failure $"cannot stop $NAME: $NAME is not running."
echo
return 1;
fi
killproc $NAME
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f ${SUBSYS_FILE}
return $RETVAL
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
esac
Jump to Line
Something went wrong with that request. Please try again.