# HG changeset patch
# User David Scott <dave.scott@xxxxxxxxxxxxx>
# Date 1261169315 0
# Node ID 46616f7e84109e5dfca48f8e6116ac166682114a
# Parent d21edee5f827c0b042412b49b18854f4fac4f261
CA-33440: Add an init.d script for the fork/exec daemon.
Signed-off-by: David Scott <dave.scott@xxxxxxxxxxxxx>
diff -r d21edee5f827 -r 46616f7e8410 Makefile.in
--- a/Makefile.in Fri Dec 18 20:48:35 2009 +0000
+++ b/Makefile.in Fri Dec 18 20:48:35 2009 +0000
@@ -29,6 +29,7 @@
ifeq ($(HAVE_DEVICE_MAPPER),1)
$(MAKE) -C camldm
endif
+ $(MAKE) -C forking_executioner
.PHONY: allxen
allxen:
@@ -63,6 +64,7 @@
ifeq ($(HAVE_DEVICE_MAPPER),1)
$(MAKE) -C camldm install
endif
+ $(MAKE) -C forking_executioner install
installxen:
ifeq ($(HAVE_XEN),1)
@@ -96,6 +98,7 @@
ifeq ($(HAVE_DEVICE_MAPPER),1)
$(MAKE) -C camldm uninstall
endif
+ $(MAKE) -C forking_executioner uninstall
uninstallxen:
ifeq ($(HAVE_XEN),1)
@@ -120,6 +123,7 @@
$(MAKE) -C sexpr bininstall
$(MAKE) -C stdext bininstall
$(MAKE) -C close-and-exec bininstall
+ $(MAKE) -C forking_executioner bininstall
binuninstall:
$(MAKE) -C pciutil binuninstall
@@ -127,6 +131,7 @@
$(MAKE) -C sexpr binuninstall
$(MAKE) -C stdext binuninstall
$(MAKE) -C close-and-exec binuninstall
+ $(MAKE) -C forking_executioner binuninstall
.PHONY: doc
doc:
@@ -148,6 +153,7 @@
$(MAKE) -C stunnel doc
$(MAKE) -C xsrpc doc
$(MAKE) -C mmap doc
+ $(MAKE) -C forking_executioner doc
.PHONY: clean
clean:
diff -r d21edee5f827 -r 46616f7e8410 forking_executioner/Makefile
--- a/forking_executioner/Makefile Fri Dec 18 20:48:35 2009 +0000
+++ b/forking_executioner/Makefile Fri Dec 18 20:48:35 2009 +0000
@@ -7,6 +7,7 @@
LDFLAGS = -cclib -L./
LIBEXEC = "/opt/xensource/libexec"
+INIT_D = "/etc/init.d"
VERSION := $(shell hg parents --template "{rev}" 2>/dev/null || echo 0.0)
OCAMLOPTFLAGS = -g -dtypes
@@ -53,8 +54,10 @@
.PHONY: bininstall
bininstall: path = $(DESTDIR)$(LIBEXEC)
bininstall: all
- mkdir -p $(path)
- $(IPROG) $(PROGRAMS) $(path)
+ mkdir -p $(DESTDIR)$(LIBEXEC)
+ $(IPROG) $(PROGRAMS) $(DESTDIR)$(LIBEXEC)
+ mkdir -p $(DESTDIR)$(INIT_D)
+ $(IPROG) init.d-fe $(DESTDIR)$(INIT_D)/fe
.PHONY: uninstall
uninstall:
@@ -62,6 +65,7 @@
.PHONY: binuninstall
binuninstall:
rm -f $(DESTDIR)$(LIBEXEC)$(PROGRAMS)
+ rm -f $(DESTDIR)$(INIT_D)/fe
.PHONY: doc
doc:
diff -r d21edee5f827 -r 46616f7e8410 forking_executioner/init.d-fe
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/forking_executioner/init.d-fe Fri Dec 18 20:48:35 2009 +0000
@@ -0,0 +1,99 @@
+#! /bin/bash
+#
+# squeezed Start/Stop the fork/exec daemon
+#
+# chkconfig: 2345 21 78
+# description: Fork/exec daemon
+# processname: fe
+# pidfile: /var/run/fe.pid
+
+# Source function library.
+. /etc/init.d/functions
+
+# Memory ballooning daemon
+
+# location of the executable:
+DAEMON="/opt/xensource/libexec/fe"
+
+# pidfile:
+PID_FILE="/var/run/fe.pid"
+
+# lock file
+SUBSYS_FILE="/var/lock/subsys/fe"
+
+# Source function library.
+. /etc/init.d/functions
+
+start() {
+ echo -n $"Starting the fork/exec daemon: "
+
+ if [ -e ${SUBSYS_FILE} ]; then
+ if [ -e ${PID_FILE} ] && [ -e /proc/`cat ${PID_FILE}` ]; then
+ echo -n $"cannot start fe: already running."
+ failure $"cannot start fe: already running."
+ echo
+ return 1
+ fi
+ fi
+
+ ${DAEMON} -daemon -pidfile ${PID_FILE} >/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 fe."
+ failure $"failed to start fe."
+ killproc fe
+ rm -f ${SUBSYS_FILE} ${PID_FILE}
+ echo
+ return 1
+}
+
+stop() {
+ echo -n $"Stopping the fork/exec daemon: "
+
+ if [ ! -e ${SUBSYS_FILE} ]; then
+ echo -n $"cannot stop fe: fe is not running."
+ failure $"cannot stop fe: fe is not running."
+ echo
+ return 1;
+ fi
+
+ killproc fe
+ 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
3 files changed, 111 insertions(+), 2 deletions(-)
Makefile.in | 6 ++
forking_executioner/Makefile | 8 ++-
forking_executioner/init.d-fe | 99 +++++++++++++++++++++++++++++++++++++++++
xen-api-libs.hg-6.patch
Description: Text Data
_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api
|