Permalink
Browse files

We use a master init.d script for the java ws and we generate the script

at build time.
  • Loading branch information...
graziano
graziano committed Aug 17, 2009
1 parent e146261 commit 8d720fca6c2926284af81190ec5deb76ad0801c7
Showing with 65 additions and 682 deletions.
  1. +2 −4 configure
  2. +1 −3 configure.ac
  3. +19 −3 tools/Makefile
  4. +0 −314 tools/eucalyptus-cloud.in
  5. +43 −44 tools/{eucalyptus-sc.in → eucalyptus-java-ws.in}
  6. +0 −314 tools/eucalyptus-walrus.in
View
@@ -6990,7 +6990,7 @@ done
# Time to substitute and generate the files
-ac_config_files="$ac_config_files Makedefs tools/eucalyptus-cc:tools/eucalyptus-cc.in tools/eucalyptus-nc:tools/eucalyptus-nc.in tools/euca_conf:tools/euca_conf.in tools/eucalyptus-cloud:tools/eucalyptus-cloud.in tools/eucalyptus-walrus:tools/eucalyptus-walrus.in tools/eucalyptus-sc:tools/eucalyptus-sc.in"
+ac_config_files="$ac_config_files Makedefs tools/eucalyptus-cc:tools/eucalyptus-cc.in tools/eucalyptus-nc:tools/eucalyptus-nc.in tools/euca_conf:tools/euca_conf.in tools/eucalyptus-java-ws:tools/eucalyptus-java-ws.in"
cat >>confdefs.h <<_ACEOF
@@ -7699,9 +7699,7 @@ do
"tools/eucalyptus-cc") CONFIG_FILES="$CONFIG_FILES tools/eucalyptus-cc:tools/eucalyptus-cc.in" ;;
"tools/eucalyptus-nc") CONFIG_FILES="$CONFIG_FILES tools/eucalyptus-nc:tools/eucalyptus-nc.in" ;;
"tools/euca_conf") CONFIG_FILES="$CONFIG_FILES tools/euca_conf:tools/euca_conf.in" ;;
- "tools/eucalyptus-cloud") CONFIG_FILES="$CONFIG_FILES tools/eucalyptus-cloud:tools/eucalyptus-cloud.in" ;;
- "tools/eucalyptus-walrus") CONFIG_FILES="$CONFIG_FILES tools/eucalyptus-walrus:tools/eucalyptus-walrus.in" ;;
- "tools/eucalyptus-sc") CONFIG_FILES="$CONFIG_FILES tools/eucalyptus-sc:tools/eucalyptus-sc.in" ;;
+ "tools/eucalyptus-java-ws") CONFIG_FILES="$CONFIG_FILES tools/eucalyptus-java-ws:tools/eucalyptus-java-ws.in" ;;
*) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
View
@@ -212,9 +212,7 @@ AC_CONFIG_FILES([Makedefs
tools/eucalyptus-cc:tools/eucalyptus-cc.in
tools/eucalyptus-nc:tools/eucalyptus-nc.in
tools/euca_conf:tools/euca_conf.in
- tools/eucalyptus-cloud:tools/eucalyptus-cloud.in
- tools/eucalyptus-walrus:tools/eucalyptus-walrus.in
- tools/eucalyptus-sc:tools/eucalyptus-sc.in])
+ tools/eucalyptus-java-ws:tools/eucalyptus-java-ws.in])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
View
@@ -5,7 +5,22 @@
include ../Makedefs
all:
- @echo nothing to do here
+ @echo "generating init.d scripts ..."
+ @# create the clc init script
+ @sed "s/WS/cloud/g" < eucalyptus-java-ws > eucalyptus-cloud
+ @sed -i "s/START/sendmail/g" eucalyptus-cloud
+ @sed -i "s/CONFNAME/Cloud Controller/g" eucalyptus-cloud
+ @sed -i "s/JARNAME/interface/g" eucalyptus-cloud
+ @# create the walrus init script
+ @sed "s/WS/walrus/g" < eucalyptus-java-ws > eucalyptus-walrus
+ @sed -i "s/START/eucalyptus-cloud/g" eucalyptus-walrus
+ @sed -i "s/CONFNAME/Walrus/g" eucalyptus-walrus
+ @sed -i "s/JARNAME/storagemgr/g" eucalyptus-walrus
+ @# create the sc init script
+ @sed "s/WS/sc/g" < eucalyptus-java-ws > eucalyptus-sc
+ @sed -i "s/START/eucalyptus-walrus/g" eucalyptus-sc
+ @sed -i "s/CONFNAME/Storage Controller/g" eucalyptus-sc
+ @sed -i "s/JARNAME/storagecontroller/g" eucalyptus-sc
build: all
@@ -15,9 +30,10 @@ clean:
rm -f *~ *.o
distclean:
- @rm -rf eucalyptus
+ @echo "removing generated files scripts ..."
+ @rm -rf eucalyptus eucalyptus-cloud eucalyptus-walrus
-install: deploy
+install: build
@if test -e /etc/init.d/eucalyptus ; then \
mv /etc/init.d/eucalyptus /etc/init.d/eucalyptus.old ; \
echo "Moving away old init.d script"; fi
View
@@ -1,314 +0,0 @@
-#!/bin/bash
-#
-# Init script for the Eucalyptus cloud manager services.
-#
-# chkconfig: 2345 99 05
-# description: script for starting and stopping eucalyptus cloud services
-#
-### BEGIN INIT INFO
-# Provides: eucalyptus-cloud
-# Required-Start: $remote_fs $syslog
-# Should-Start: sendmail
-# Required-Stop: $remote_fs $syslog
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Short-Description: Start Eucalyptus cloud controller
-# Description: Start the Eucalyptus cloud controller
-# X-UnitedLinux-Default-Enabled: yes
-### END INIT INFO
-#
-
-# Do NOT "set -e"
-
-# we need to source the current path in case of manual intallation
-export PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH
-DESC="Eucalyptus cloud controller"
-NAME=eucalyptus-cloud
-ANT="`which ant 2> /dev/null`"
-JAVA="`which java 2> /dev/null`"
-EUCA_USER="eucalyptus"
-
-
-if [ "$EUID" != "0" ]; then
- echo "Eucalyptus init scripts must be run as root."
- exit 1
-fi
-
-# if we have lsb functions let's source them
-WE_HAVE_LSB="N"
-if [ -e /lib/lsb/init-functions ]; then
- . /lib/lsb/init-functions
- # very old lsb don't have the functions we need
- if type log_daemon_msg > /dev/null 2> /dev/null ; then
- WE_HAVE_LSB="Y"
- fi
-fi
-
-# honor the ENV variable if found otherwise look in root
-if [ -z "$EUCALYPTUS" ] ; then
- EUCALYPTUS="@prefix@"
- if [ ! -e ${EUCALYPTUS}/etc/eucalyptus/eucalyptus.conf ] ; then
- EUCALYPTUS="/"
- fi
-fi
-export EUCALYPTUS
-export EUCA_VERSION=`cat $EUCALYPTUS/etc/eucalyptus/eucalyptus-version`
-JAR_NAME="/usr/share/eucalyptus/eucalyptus-interface-${EUCA_VERSION}.jar"
-JAR_ALL_NAMES="/usr/share/eucalyptus/eucalyptus-interface-${EUCA_VERSION}.jar /usr/share/eucalyptus/eucalyptus-storagecontroller-${EUCA_VERSION}.jar /usr/share/eucalyptus/eucalyptus-storagemgr-${EUCA_VERSION}.jar"
-
-
-# just a quick way to check if we have the package still installed: at
-# times we can still have the init.d script
-if [ ! -x $EUCALYPTUS/usr/sbin/euca_conf ]; then
- echo "Some eucalyptus components are missing"
- exit 1
-fi
-
-check_java() {
- java_min_version="1.6.0"
-
- # we need a good JAVA_HOME
- if [ -z "$JAVA_HOME" ]; then
- # user didn't setup JAVA_HOME, let's look for it
- if [ -z "$JAVA" ]; then
- echo "Cannot find java!"
- exit 1
- fi
- JAVA_HOME="`readlink -f $JAVA`"
- JAVA_HOME="`dirname $JAVA_HOME|sed 's:/jre/bin::'`"
- if [ ! -d $JAVA_HOME ]; then
- echo "Cannot find a good JAVA_HOME"
- exit 1
- fi
- fi
-
- # to be sure we are using the right java/JAVA_HOME
- JAVA="$JAVA_HOME/jre/bin/java"
-
- # let's see if we can find a decent java
- if [ -x "$JAVA" ]; then
- java_version=`$JAVA -version 2>&1 | grep "java version" | sed -e 's/.*java version "\(.*\)".*/\1/'`
- if [ `expr $java_version "<" $java_min_version` -eq 0 ]; then
- export JAVA_HOME
- return
- fi
- fi
-
- echo "Eucalyptus needs java version >= $java_min_version"
- exit 1
-}
-
-do_start() {
- local ret
-
- # basic checks
- check_java
- if ! $EUCALYPTUS/usr/sbin/euca_conf -check cloud ; then
- exit 1
- fi
-
- cd $EUCALYPTUS/etc/eucalyptus
-# (su -p $EUCA_USER -c "/bin/bash $ANT -f cloud.xml run" > $EUCALYPTUS/var/log/eucalyptus/cloud-output.log 2>&1) &
- $EUCALYPTUS/usr/sbin/eucalyptus-cloud -h $EUCALYPTUS -u $EUCA_USER --pidfile $EUCALYPTUS/var/run/eucalyptus/eucalyptus-cloud.pid -f -o $EUCALYPTUS/var/log/eucalyptus/cloud-output.log >/dev/null 2>&1
- ret="$?"
-# echo "$!" > $EUCALYPTUS/var/run/eucalyptus/eucalyptus-cloud.pid
- return $ret
-}
-
-do_status() {
- if [ ! -e ${EUCALYPTUS}${JAR_NAME} ]; then
- # service is not running
- return 1
- fi
-
- pidfile=$EUCALYPTUS/var/run/eucalyptus/eucalyptus-cloud.pid
- if [ -s $pidfile ]; then
- pid=`cat $pidfile 2> /dev/null`
- if ps ax|grep $pid|grep cloud.xml> /dev/null ; then
- # we are good
- return 0
- fi
- fi
- return 1
-}
-
-do_stop() {
- pidfile=$EUCALYPTUS/var/run/eucalyptus/eucalyptus-cloud.pid
- echo $pidfile
- # now kill the service
- if [ -s "$pidfile" ]; then
- pid=`cat $pidfile 2> /dev/null`
- kill $pid 2> /dev/null >/dev/null
- else
- return
- fi
-
- # let's way few seconds than kill harder
- timeout=20
- while [ $timeout -gt 0 ]; do
- if ps $pid > /dev/null 2>&1 ; then
- sleep 1
- timeout=$(($timeout - 1))
- else
- break
- fi
- done
- if [ $timeout -eq 0 ]; then
- kill -9 $pid > /dev/null 2>&1
- fi
- rm -f $pidfile
-}
-
-# Read configuration variable file if it is present
-if [ -r $EUCALYPTUS/etc/eucalyptus/eucalyptus.conf ]; then
- . $EUCALYPTUS/etc/eucalyptus/eucalyptus.conf
-else
- echo "Cannot find eucalyptus configuration file!"
- exit 1
-fi
-if [ "$EUCALYPTUS" = "not_configured" ]; then
- echo "EUCALYPTUS not configured!"
- exit 1
-fi
-
-# let's get the user to use
-if [ -z "$EUCA_USER" ] ; then
- EUCA_USER="root"
-fi
-
-# set the library path correctly
-export LD_LIBRARY_PATH="$EUCALYPTUS/usr/lib/eucalyptus:$LD_LIBRARY_PATH"
-
-case "$1" in
- start)
- if [ "$VERBOSE" != no ]; then
- if [ "$WE_HAVE_LSB" = "Y" ]; then
- log_daemon_msg "Starting $DESC" "$NAME"
- else
- echo -n "Starting $DESC: "
- fi
- fi
-
- # let's check there is no previous cloud running
- if do_status ; then
- echo
- echo "another CLC is already running!"
- if [ "$VERBOSE" != no ]; then
- if [ "$WE_HAVE_LSB" = "Y" ]; then
- log_end_msg 1
- fi
- fi
- exit 1
- fi
-
- # move the jar in the right place
- if [ -e ${EUCALYPTUS}${JAR_NAME}.disabled ]; then
- if ! cp ${EUCALYPTUS}${JAR_NAME}.disabled ${EUCALYPTUS}${JAR_NAME} ; then
- echo "Failed to copy jar file into place!"
- exit 1
- fi
- rm -f ${EUCALYPTUS}${JAR_NAME}.disabled
- fi
-
- # since other services could be running, we stop the container
- # before starting
- do_stop
- do_start
- case "$?" in
- 0|1)
- if [ "$VERBOSE" != no ]; then
- if [ "$WE_HAVE_LSB" = "Y" ]; then
- log_end_msg 0
- else
- echo "done."
- fi
- fi
- ;;
- *)
- if [ "$VERBOSE" != no ]; then
- if [ "$WE_HAVE_LSB" = "Y" ]; then
- log_end_msg 1
- else
- echo "failed!"
- fi
- fi
- ;;
- esac
- ;;
- stop)
- if [ "$VERBOSE" != no ]; then
- if [ "$WE_HAVE_LSB" = "Y" ]; then
- log_begin_msg "Stopping $DESC"
- else
- echo -n "Stopping $DESC: "
- fi
- fi
-
- # if we don't have the JAR file we are not running
- if [ ! -e ${EUCALYPTUS}${JAR_NAME} ]; then
- # service is not running
- echo "service is not running ${EUCALYPTUS}${JAR_NAME}"
- exit 0
- fi
-
- # move the jar in the right place
- if ! cp ${EUCALYPTUS}${JAR_NAME} ${EUCALYPTUS}${JAR_NAME}.disabled ; then
- echo "Failed to copy jar file into place!"
- exit 1
- fi
- rm -f ${EUCALYPTUS}${JAR_NAME}
-
- # now let's stop the service
- do_stop
-
- # if we have more services running, we'll need to restart
- __restart="N"
- for x in $JAR_ALL_NAMES ; do
- if [ -e ${EUCALYPTUS}/${x} ]; then
- __restart="Y"
- break
- fi
- done
- if [ ${__restart} = "Y" ]; then
- do_start
- fi
- if [ "$VERBOSE" != no ]; then
- if [ "$WE_HAVE_LSB" = "Y" ]; then
- log_end_msg 0
- else
- echo "done."
- fi
- fi
- ;;
- restart)
- if [ "$VERBOSE" != no ]; then
- if [ "$WE_HAVE_LSB" = "Y" ]; then
- log_begin_msg "Restarting $DESC"
- else
- echo -n "Restarting $DESC: "
- fi
- fi
- do_stop
- do_start
- if [ "$VERBOSE" != no ]; then
- if [ "$WE_HAVE_LSB" = "Y" ]; then
- log_end_msg 0
- else
- echo "done."
- fi
- fi
- ;;
- status)
- if do_status ; then
- echo "CLC is running"
- else
- exit 3
- fi
- ;;
- *)
- echo "Usage: $NAME {start|stop|restart}" >&2
- exit 3
- ;;
-esac
-
-:
Oops, something went wrong.

0 comments on commit 8d720fc

Please sign in to comment.