leif 2003/03/10 00:09:05
Modified: . build.xml
Added: src/script InstallPhoenix-NT.bat phoenix-wrapper.bash
phoenix-wrapper.sh Phoenix.bat
UninstallPhoenix-NT.bat
Log:
Get platform dependent builds which include the Wrapper working.
Revision Changes Path
1.219 +296 -67 avalon-phoenix/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/avalon-phoenix/build.xml,v
retrieving revision 1.218
retrieving revision 1.219
diff -u -r1.218 -r1.219
--- build.xml 6 Mar 2003 12:27:28 -0000 1.218
+++ build.xml 10 Mar 2003 08:09:05 -0000 1.219
@@ -31,6 +31,9 @@
<property file="project.properties"/>
+ <!-- platform -->
+ <property name="is.${os.name}" value="true"/>
+
<property name="build.debug" value="on"/>
<property name="build.optimize" value="off"/>
<property name="build.deprecation" value="off"/>
@@ -85,13 +88,17 @@
<property name="announce2site"
value="${phoenix.tools.dir}/announcement2site.xsl"/>
<property name="status2changes"
value="${phoenix.tools.dir}/status2changes.xsl"/>
+ <!-- Invoke 'ant get-wrapper' to get these -->
+ <property name="wrapper.version" value="3.0.0"/>
+ <property name="wrapper.jar" value="${repo.dir}/wrapper/bin/wrapper.jar"/>
+
<!-- Invoke 'ant get-mx4j' to get these -->
<property name="mx4j.jar" value="${repo.dir}/mx4j/mx4j-1.1.1/lib/mx4j-jmx.jar"/>
<property name="mx4j-tools.jar"
value="${repo.dir}/mx4j/mx4j-1.1.1/lib/mx4j-tools.jar"/>
<!-- Invoke 'ant get-beanshell' to get this -->
<property name="beanshell.jar" value="${repo.dir}/beanshell/bsh-1.2b7.jar"/>
-
+
<path id="project.class.path">
<pathelement location="${xerces.jar}"/>
<pathelement location="${framework.jar}"/>
@@ -122,57 +129,194 @@
<path refid="project.class.path"/>
</path>
- <!-- Main target -->
- <target name="main" depends="dist-lite"
- description="generates the Phoenix distribution without the javadocs"/>
+ <!-- =================================================================== -->
+ <!-- Resolve Platform properties -->
+ <!-- =================================================================== -->
+ <target name="init-windows-nt" if="is.Windows NT">
+ <property name="is.Windows" value="true"/>
+ <property name="is.shell.bat" value="true"/>
+ <property name="wrapper.dist.name"
value="wrapper_win32_${wrapper.version}"/>
+ <property name="dist.name.wrapper" value="${name}_win32_${version}"/>
+ </target>
+ <target name="init-windows-2000" if="is.Windows 2000">
+ <property name="is.Windows" value="true"/>
+ <property name="is.shell.bat" value="true"/>
+ <property name="wrapper.dist.name"
value="wrapper_win32_${wrapper.version}"/>
+ <property name="dist.name.wrapper" value="${name}_win32_${version}"/>
+ </target>
+ <target name="init-windows-xp" if="is.Windows XP">
+ <property name="is.Windows" value="true"/>
+ <property name="is.shell.bat" value="true"/>
+ <property name="wrapper.dist.name"
value="wrapper_win32_${wrapper.version}"/>
+ <property name="dist.name.wrapper" value="${name}_win32_${version}"/>
+ </target>
+ <target name="init-linux" if="is.Linux">
+ <property name="is.Unix" value="true"/>
+ <property name="is.shell.bash" value="true"/>
+ <property name="phoenix-wrapper.sh"
value="${script.dir}/phoenix-wrapper.bash"/>
+ <property name="wrapper.dist.name"
value="wrapper_linux_${wrapper.version}"/>
+ <property name="dist.name.wrapper" value="${name}_linux_${version}"/>
+ </target>
+ <target name="init-solaris" if="is.SunOS">
+ <property name="is.Unix" value="true"/>
+ <property name="is.shell.sh" value="true"/>
+ <property name="phoenix-wrapper.sh"
value="${script.dir}/phoenix-wrapper.sh"/>
+ <property name="wrapper.dist.name"
value="wrapper_solaris_${wrapper.version}"/>
+ <property name="dist.name.wrapper" value="${name}_solaris_${version}"/>
+ </target>
+ <target name="init-aix" if="is.AIX">
+ <property name="is.Unix" value="true"/>
+ <property name="is.shell.sh" value="true"/>
+ <property name="phoenix-wrapper.sh"
value="${script.dir}/phoenix-wrapper.sh"/>
+ <property name="wrapper.dist.name" value="wrapper_aix_${wrapper.version}"/>
+ <property name="dist.name.wrapper" value="${name}_aix_${version}"/>
+ </target>
+ <target name="init-hpux" if="is.HP-UX">
+ <property name="is.Unix" value="true"/>
+ <property name="is.shell.sh" value="true"/>
+ <property name="phoenix-wrapper.sh"
value="${script.dir}/phoenix-wrapper.sh"/>
+ <property name="wrapper.dist.name" value="wrapper_hpux_${wrapper.version}"/>
+ <property name="dist.name.wrapper" value="${name}_hpux_${version}"/>
+ </target>
+
+ <!-- =================================================================== -->
+ <!-- Initialize build. -->
+ <!-- =================================================================== -->
+ <target name="init"
+ depends="init-windows-nt, init-windows-2000, init-windows-xp, init-linux,
init-solaris, init-aix, init-hpux">
+ <echo message="OS='${os.name}'"/>
+
+ <!-- Wrapper filters -->
+ <filter token="app.name" value="phoenix"/>
+ <filter token="app.long.name" value="Phoenix Application Server"/>
- <target name="rebuild" description="Rebuilds Phoenix">
- <antcall target="clean" inheritall="false"/>
- <antcall target="main" inheritall="false"/>
- <antcall target="test" inheritall="false"/>
</target>
+
+ <!-- =================================================================== -->
+ <!-- Wrapper Tasks. -->
+ <!-- =================================================================== -->
+ <target name="check-wrapper-init" depends="init">
+ <available property="wrapper.present"
classname="org.tanukisoftware.wrapper.WrapperManager">
+ <classpath refid="project.class.path"/>
+ </available>
+
+ <condition property="wrapper.present.Windows">
+ <and>
+ <isset property="wrapper.present"/>
+ <isset property="is.Windows"/>
+ </and>
+ </condition>
+
+ <condition property="wrapper.present.Unix">
+ <and>
+ <isset property="wrapper.present"/>
+ <isset property="is.Unix"/>
+ </and>
+ </condition>
+ </target>
+
+ <target name="check-wrapper" depends="check-wrapper-init"
unless="wrapper.present">
+ <echo>*****************************</echo>
+ <echo>* Please execute target *</echo>
+ <echo>* 'get-wrapper' in the main *</echo>
+ <echo>* build.xml build file *</echo>
+ <echo>* to download one and *</echo>
+ <echo>* a half Mb of Wrapper *</echo>
+ <echo>*****************************</echo>
+ </target>
+
+ <!-- Get the files from the Wrapper project. -->
+ <target name="get-wrapper-test" depends="init" unless="wrapper.dist.name">
+ <echo>**********************************************************</echo>
+ <echo>* A prebuilt version of the Wrapper does not yet exist</echo>
+ <echo>* for the ${os.name} platform. You will have to download</echo>
+ <echo>* the source from http://wrapper.tanukisoftware.org and</echo>
+ <echo>* try compiling it for ${os.name} platform. The resulting</echo>
+ <echo>* distribution should then be placed into the</echo>
+ <echo>* ${repo.dir}/wrapper directory.</echo>
+ <echo>**********************************************************</echo>
+ <fail message="A prebuilt version of the Wrapper does not exist for the
${os.name} platform"/>
+ </target>
+ <target name="get-wrapper-windows" if="is.Windows">
+ <mkdir dir="${repo.dir}/wrapper"/>
+ <get
src="http://telia.dl.sourceforge.net/sourceforge/wrapper/${wrapper.dist.name}.zip"
+ dest="${repo.dir}/wrapper/${wrapper.dist.name}.zip"
+ verbose="true"
+ usetimestamp="true"/>
+ <unzip src="${repo.dir}/wrapper/${wrapper.dist.name}.zip"
dest="${repo.dir}/wrapper"/>
+ <copy file="${repo.dir}/wrapper/${wrapper.dist.name}/bin/Wrapper.exe"
todir="${repo.dir}/wrapper/bin"/>
+ <copy file="${repo.dir}/wrapper/${wrapper.dist.name}/lib/Wrapper.dll"
todir="${repo.dir}/wrapper/bin"/>
+ <copy file="${repo.dir}/wrapper/${wrapper.dist.name}/lib/wrapper.jar"
todir="${repo.dir}/wrapper/bin"/>
+ </target>
+ <target name="get-wrapper-unix" if="is.Unix">
+ <mkdir dir="${repo.dir}/wrapper"/>
+ <get
src="http://telia.dl.sourceforge.net/sourceforge/wrapper/${wrapper.dist.name}.zip"
+ dest="${repo.dir}/wrapper/${wrapper.dist.name}.zip"
+ verbose="true"
+ usetimestamp="true"/>
+ <gunzip src="${repo.dir}/wrapper/${wrapper.dist.name}.tar.gz"
dest="${repo.dir}/wrapper"/>
+ <untar src="${repo.dir}/wrapper/${wrapper.dist.name}.tar"
dest="${repo.dir}/wrapper"/>
+ <copy file="${repo.dir}/wrapper/${wrapper.dist.name}/bin/wrapper"
todir="${repo.dir}/wrapper/bin"/>
+ <copy file="${repo.dir}/wrapper/${wrapper.dist.name}/bin/realpath"
todir="${repo.dir}/wrapper/bin"/>
+ <copy file="${repo.dir}/wrapper/${wrapper.dist.name}/lib/libwrapper.so"
todir="${repo.dir}/wrapper/bin"/>
+ <copy file="${repo.dir}/wrapper/${wrapper.dist.name}/lib/wrapper.jar"
todir="${repo.dir}/wrapper/bin"/>
+ </target>
+ <target name="get-wrapper"
+ depends="get-wrapper-test, get-wrapper-windows, get-wrapper-unix"
+ description="Get the Wrapper distribution from SourceForge.">
+ <mkdir dir="${repo.dir}/wrapper"/>
+ </target>
+
+ <target name="dist-lite-wrapper-windows" depends="dist-lite"
if="wrapper.present.Windows">
+ <copy file="${repo.dir}/wrapper/bin/Wrapper.exe" todir="${bin.dist.bin}"/>
+ <copy file="${repo.dir}/wrapper/bin/Wrapper.dll" todir="${bin.dist.bin}"/>
+
+ <copy file="${script.dir}/Phoenix.bat" todir="${bin.dist.bin}"/>
+ <copy file="${script.dir}/InstallPhoenix-NT.bat" todir="${bin.dist.bin}"/>
+ <copy file="${script.dir}/UninstallPhoenix-NT.bat" todir="${bin.dist.bin}"/>
+ </target>
+ <target name="dist-lite-wrapper-unix" depends="dist-lite"
if="wrapper.present.Unix">
+ <copy file="${repo.dir}/wrapper/bin/wrapper" todir="${bin.dist.bin}"/>
+ <copy file="${repo.dir}/wrapper/bin/realpath" todir="${bin.dist.bin}"/>
+ <copy file="${repo.dir}/wrapper/bin/libwrapper.so" todir="${bin.dist.bin}"/>
+
+ <copy file="${phoenix-wrapper.sh}"
tofile="${bin.dist.bin}/phoenix-wrapper.sh"/>
+ </target>
+ <target name="dist-lite-wrapper" depends="dist-lite-wrapper-windows,
dist-lite-wrapper-unix"
+ if="wrapper.present"
+ description="generates the Phoenix binary distribution without the javadocs
and with wrapper">
- <target name="all" depends="main, site-all" description="generates the Phoenix
distribution"/>
-
- <!-- Help on usage -->
- <target name="usage">
- <echo message="Use the -projecthelp option instead"/>
+ <copy file="${wrapper.jar}" todir="${bin.dist.bin}"/>
+ <copy file="${conf.dir}/wrapper.conf" todir="${bin.dist.conf}"/>
+ <fixcrlf srcdir="${bin.dist.conf}" includes="wrapper.conf" eol="lf"/>
+
+ <fixcrlf srcdir="${bin.dist.dir}" includes="**/*.bat" eol="crlf"/>
+ <fixcrlf srcdir="${bin.dist.dir}" includes="**/*.sh" eol="lf"/>
+ <chmod file="${bin.dist.bin}/*.sh" perm="u+x"/>
+ <chmod file="${bin.dist.bin}/*.bat" perm="u-x"/>
</target>
- <target name="help" depends="usage"/>
+
- <!-- Check requirements of environment -->
- <target name="check-mx4j">
+ <!-- =================================================================== -->
+ <!-- JMX Tasks. -->
+ <!-- =================================================================== -->
+ <target name="check-mx4j-init" depends="init">
<available property="mx4j.present" classname="mx4j.util.StandardMBeanProxy">
<classpath refid="project.class.path"/>
</available>
- <antcall target="check-mx4j2"/>
</target>
- <target name="check-mx4j2" unless="mx4j.present">
+ <target name="check-mx4j" depends="check-mx4j-init" unless="mx4j.present">
<echo>**************************</echo>
<echo>* Please execute target *</echo>
<echo>* 'get-mx4j' in the main *</echo>
- <echo>* target.xml build file *</echo>
+ <echo>* build.xml build file *</echo>
<echo>* to download one and *</echo>
<echo>* a half Mb of MX4J *</echo>
<echo>**************************</echo>
<fail message="MX4J needed. See above."/>
</target>
-
- <!-- Check requirements of environment -->
- <target name="check-environment" depends="check-mx4j">
- <available property="xerces.present" type="file" file="${xerces.jar}"/>
- <available property="servlet.present" classname="javax.servlet.Servlet">
- <classpath refid="project.class.path"/>
- </available>
- <available property="wrapper.present"
classname="org.tanukisoftware.wrapper.WrapperManager">
- <classpath refid="project.class.path"/>
- </available>
- <available property="beanshell.present" classname="bsh.util.JConsole">
- <classpath refid="project.class.path"/>
- </available>
- </target>
-
+
<!-- Get the jars from the MX4J project. -->
<!-- For licensing reasons, we are unable to put these Jars in our CVS or
source distributions. -->
<target name="get-mx4j" description="Get the MX4J distribution from
SourceForge.">
@@ -184,6 +328,41 @@
<gunzip src="${repo.dir}/mx4j/mx4j.tar.gz" dest="${repo.dir}/mx4j"/>
<untar src="${repo.dir}/mx4j/mx4j.tar" dest="${repo.dir}/mx4j"/>
</target>
+
+
+
+
+ <!-- Main target -->
+ <target name="main" depends="dist-lite"
+ description="generates the Phoenix distribution without the javadocs"/>
+
+ <target name="rebuild" description="Rebuilds Phoenix">
+ <antcall target="clean" inheritall="false"/>
+ <antcall target="main" inheritall="false"/>
+ <antcall target="test" inheritall="false"/>
+ </target>
+
+ <target name="all" depends="main, site-all" description="generates the Phoenix
distribution"/>
+
+ <!-- Help on usage -->
+ <target name="usage">
+ <echo message="Use the -projecthelp option instead"/>
+ </target>
+ <target name="help" depends="usage"/>
+
+
+ <!-- Check requirements of environment -->
+ <target name="check-environment" depends="check-mx4j, check-wrapper">
+ <available property="xerces.present" type="file" file="${xerces.jar}"/>
+ <available property="servlet.present" classname="javax.servlet.Servlet">
+ <classpath refid="project.class.path"/>
+ </available>
+ <available property="beanshell.present" classname="bsh.util.JConsole">
+ <classpath refid="project.class.path"/>
+ </available>
+ </target>
+
+
<!-- Get the jars from the Beanshell project. -->
<!-- For licensing reasons, we are unable to put these Jars in our CVS or
source distributions. -->
@@ -553,21 +732,6 @@
</target>
<!-- Create the lite build -->
- <target name="dist-lite-wrapper" depends="dist-lite" if="wrapper.present"
- description="generates the Phoenix binary distribution without the javadocs
and with wrapper">
-
- <!-- Wrapper filters -->
- <filter token="app.name" value="phoenix"/>
- <filter token="app.long.name" value="Phoenix Application Server"/>
-
- <copy file="${wrapper.jar}" todir="${bin.dist.bin}"/>
- <copy file="${wrapper.exe}" todir="${bin.dist.bin}"/>
- <copy file="${wrapper.dll}" todir="${bin.dist.bin}"/>
-
- <chmod file="${bin.dist.bin}/wrapper" perm="u+x"/>
- <copy file="${conf.dir}/wrapper.conf" todir="${bin.dist.conf}"/>
- <fixcrlf srcdir="${bin.dist.conf}" includes="wrapper.conf" eol="lf"/>
- </target>
<target name="install"
depends="dist-lite-wrapper,install-check-phoenix"
@@ -711,9 +875,34 @@
</target>
<!-- Completely build all dists -->
- <target name="dist" depends="site-all, announcement" description="generates the
Phoenix distribution">
+ <target name="dist-src" depends="site-all, announcement">
+ <mkdir dir="${dist.base}"/>
+ <delete dir="${dist.name}"/>
+ <antcall target="src-dist">
+ <param name="src.dist.dir" value="${dist.name}"/>
+ </antcall>
+
+ <zip zipfile="${dist.base}/${dist.name}-src.zip"
+ basedir="${dist.name}/.."
+ includes="${dist.name}/**"/>
+
+ <tar longfile="gnu" tarfile="${dist.base}/${dist.name}-src.tar">
+ <tarfileset dir="${dist.name}/.." username="avalon" group="avalon">
+ <include name="${dist.name}/**"/>
+ </tarfileset>
+ </tar>
+
+ <gzip zipfile="${dist.base}/${dist.name}-src.tar.gz"
+ src="${dist.base}/${dist.name}-src.tar"/>
+
+ <delete file="${dist.base}/${dist.name}-src.tar"/>
+ <delete dir="${dist.name}"/>
+ </target>
+
+ <target name="dist-bin" depends="dist-src">
<mkdir dir="${dist.base}"/>
+ <delete dir="${dist.name}"/>
<antcall target="bin-dist">
<param name="bin.dist.dir" value="${dist.name}"/>
@@ -753,28 +942,68 @@
<delete file="${dist.base}/${dist.name}-bin.tar"/>
- <delete dir="${dist.name}"/>
-
- <antcall target="src-dist">
- <param name="src.dist.dir" value="${dist.name}"/>
- </antcall>
-
- <zip zipfile="${dist.base}/${dist.name}-src.zip"
- basedir="${dist.name}/.."
- includes="${dist.name}/**"/>
-
- <tar longfile="gnu" tarfile="${dist.base}/${dist.name}-src.tar">
- <tarfileset dir="${dist.name}/.." username="avalon" group="avalon">
- <include name="${dist.name}/**"/>
+ <!-- Do not delete the temp dir yet as it is needed by the platform
specific builds. -->
+ </target>
+
+ <target name="dist-wrapper-windows" depends="dist-bin, check-wrapper"
if="wrapper.present.Windows">
+ <copy todir="${dist.name.wrapper}">
+ <fileset dir="${dist.name}"/>
+ </copy>
+
+ <copy file="${repo.dir}/wrapper/bin/Wrapper.exe"
todir="${dist.name.wrapper}/bin"/>
+ <copy file="${repo.dir}/wrapper/bin/Wrapper.dll"
todir="${dist.name.wrapper}/bin"/>
+ <copy file="${wrapper.jar}" todir="${dist.name.wrapper}/bin"/>
+ <copy file="${conf.dir}/wrapper.conf" todir="${dist.name.wrapper}/conf"/>
+
+ <copy file="${script.dir}/Phoenix.bat" todir="${dist.name.wrapper}/bin"/>
+ <copy file="${script.dir}/InstallPhoenix-NT.bat"
todir="${dist.name.wrapper}/bin"/>
+ <copy file="${script.dir}/UninstallPhoenix-NT.bat"
todir="${dist.name.wrapper}/bin"/>
+
+ <zip zipfile="${dist.base}/${dist.name.wrapper}-bin.zip">
+ <fileset dir="${dist.name.wrapper}/..">
+ <include name="${dist.name.wrapper}/**"/>
+ <exclude name="${dist.name.wrapper}/lib/bsh*.jar"/>
+ </fileset>
+ </zip>
+
+ <delete dir="${dist.name.wrapper}"/>
+ </target>
+ <target name="dist-wrapper-unix" depends="dist-bin, check-wrapper"
if="wrapper.present.Unix">
+ <copy todir="${dist.name.wrapper}">
+ <fileset dir="${dist.name}"/>
+ </copy>
+
+ <copy file="${repo.dir}/wrapper/bin/wrapper"
todir="${dist.name.wrapper}/bin"/>
+ <copy file="${repo.dir}/wrapper/bin/realpath"
todir="${dist.name.wrapper}/bin"/>
+ <copy file="${repo.dir}/wrapper/bin/libwrapper.so"
todir="${dist.name.wrapper}/bin"/>
+ <copy file="${wrapper.jar}" todir="${dist.name.wrapper}/bin"/>
+ <copy file="${conf.dir}/wrapper.conf" todir="${dist.name.wrapper}/conf"/>
+
+ <copy file="${phoenix-wrapper.sh}"
todir="${dist.name.wrapper}/bin/phoenix-wrapper.sh"/>
+
+ <tar longfile="gnu" tarfile="${dist.base}/${dist.name.wrapper}-bin.tar">
+ <tarfileset dir="${dist.name.wrapper}/.." mode="755" username="avalon"
group="avalon">
+ <include name="${dist.name.wrapper}/bin/*.sh"/>
+ <include name="${dist.name.wrapper}/bin/wrapper"/>
+ <include name="${dist.name.wrapper}/bin/realpath"/>
+ </tarfileset>
+ <tarfileset dir="${dist.name.wrapper}/.." username="avalon"
group="avalon">
+ <include name="${dist.name.wrapper}/**"/>
+ <exclude name="${dist.name.wrapper}/bin/*.sh"/>
+ <exclude name="${dist.name.wrapper}/lib/bsh*.jar"/>
</tarfileset>
</tar>
- <gzip zipfile="${dist.base}/${dist.name}-src.tar.gz"
- src="${dist.base}/${dist.name}-src.tar"/>
+ <gzip zipfile="${dist.base}/${dist.name.wrapper}-bin.tar.gz"
+ src="${dist.base}/${dist.name.wrapper}-bin.tar"/>
- <delete file="${dist.base}/${dist.name}-src.tar"/>
+ <delete file="${dist.base}/${dist.name.wrapper}-bin.tar"/>
+ <delete dir="${dist.name.wrapper}"/>
+ </target>
+ <target name="dist" depends="dist-wrapper-windows, dist-wrapper-unix"
+ description="generates the Phoenix distribution">
+
<delete dir="${dist.name}"/>
-
</target>
<!-- Makes the Phoneix Development Kit -->
1.1 avalon-phoenix/src/script/InstallPhoenix-NT.bat
Index: InstallPhoenix-NT.bat
===================================================================
@echo off
rem
rem Find the application home.
rem
if "%OS%"=="Windows_NT" goto nt
echo This is not NT, so please edit this script and set _APP_HOME manually
set _APP_HOME=..
goto conf
:nt
rem %~dp0 is name of current script under NT
set _APP_HOME=%~dp0
rem : operator works similar to make : operator
set _APP_HOME=%_APP_HOME:\bin\=%
rem
rem Find the wrapper.conf
rem
:conf
set _WRAPPER_CONF="%~f1"
if not %_WRAPPER_CONF%=="" goto startup
set _WRAPPER_CONF="%_APP_HOME%\conf\wrapper.conf"
rem
rem Run the application.
rem At runtime, the current directory will be that of Wrapper.exe
rem
:startup
"%_APP_HOME%\bin\Wrapper.exe" -i %_WRAPPER_CONF%
if not errorlevel 1 goto end
pause
:end
set _APP_HOME=
set _WRAPPER_CONF=
1.1 avalon-phoenix/src/script/phoenix-wrapper.bash
Index: phoenix-wrapper.bash
===================================================================
#! /bin/bash
#
# Skeleton bash script suitable for starting and stopping
# wrapped Java apps on the Linux platform.
#
# This script expects to find the 'realpath' executable
# in the same directory.
#
#-----------------------------------------------------------------------------
# These settings can be modified to fit the needs of your application
# Application
APP_NAME="phoenix"
APP_LONG_NAME="Phoenix Application Server"
# Wrapper
WRAPPER_CMD="./wrapper"
WRAPPER_CONF="../conf/wrapper.conf"
# Priority (see the start() method if you want to use this)
PRIORITY=
# Do not modify anything beyond this point
#-----------------------------------------------------------------------------
# Get to the actual location of this script
SCRIPT_DIR=`dirname $0`
SCRIPT=`$SCRIPT_DIR/realpath $0`
cd `dirname $SCRIPT`
# Find pidof.
PIDOF="/bin/pidof"
if [ ! -x $PIDOF ]
then
PIDOF="/sbin/pidof"
if [ ! -x $PIDOF ]
then
echo "Cannot find 'pidof' in /bin or /sbin."
echo "This script requires 'pidof' to run."
exit 1
fi
fi
console() {
echo "Running $APP_LONG_NAME..."
pid=`$PIDOF $APP_NAME`
if [ -z $pid ]
then
# If you wanted to specify the priority with which
# your app runs, you could use nice here:
# exec -a $APP_NAME nice -$PRIORITY $WRAPPER_CMD $WRAPPER_CONF
# See "man nice" for more details.
exec -a $APP_NAME $WRAPPER_CMD $WRAPPER_CONF
else
echo "$APP_LONG_NAME is already running."
exit 1
fi
}
start() {
echo "Starting $APP_LONG_NAME..."
pid=`$PIDOF $APP_NAME`
if [ -z $pid ]
then
# If you wanted to specify the priority with which
# your app runs, you could use nice here:
# exec -a $APP_NAME nice -$PRIORITY $WRAPPER_CMD $WRAPPER_CONF
wrapper.daemonize=TRUE
# See "man nice" for more details.
exec -a $APP_NAME $WRAPPER_CMD $WRAPPER_CONF wrapper.daemonize=TRUE
else
echo "$APP_LONG_NAME is already running."
exit 1
fi
}
stop() {
echo "Stopping $APP_LONG_NAME..."
pid=`$PIDOF $APP_NAME`
if [ -z $pid ]
then
echo "$APP_LONG_NAME was not running."
else
kill $pid
sleep 6
pid=`$PIDOF $APP_NAME`
if [ ! -z $pid ]
then
kill -9 $pid
fi
pid=`$PIDOF $APP_NAME`
if [ ! -z $pid ]
then
echo "Failed to stop $APP_LONG_NAME."
else
echo "Stopped $APP_LONG_NAME."
fi
fi
}
dump() {
echo "Dumping $APP_LONG_NAME..."
pid=`$PIDOF $APP_NAME`
if [ -z $pid ]
then
echo "$APP_LONG_NAME was not running."
else
kill -3 $pid
if [ $? -ne 0 ]
then
echo "Failed to dump $APP_LONG_NAME."
else
echo "Dumped $APP_LONG_NAME."
fi
fi
}
case "$1" in
'console')
console
;;
'start')
start
;;
'stop')
stop
;;
'restart')
stop
start
;;
'dump')
dump
;;
*)
echo "Usage: $0 { console | start | stop | restart | dump }"
exit 1
;;
esac
exit 0
1.1 avalon-phoenix/src/script/phoenix-wrapper.sh
Index: phoenix-wrapper.sh
===================================================================
#! /bin/sh
#
# Skeleton sh script suitable for starting and stopping
# wrapped Java apps on the Solaris platform.
#
# This script expects to find the 'realpath' executable
# in the same directory.
#
# Make sure that PIDFILE points to the correct location,
# if you have changed the default location set in the
# wrapper configuration file.
#
#-----------------------------------------------------------------------------
# These settings can be modified to fit the needs of your application
# Application
APP_NAME="phoenix"
APP_LONG_NAME="Phoenix Application Server"
# Wrapper
WRAPPER_CMD="./wrapper"
WRAPPER_CONF="../conf/wrapper.conf"
# Priority (see the start() method if you want to use this)
PRIORITY=
# Do not modify anything beyond this point
#-----------------------------------------------------------------------------
# Get to the actual location of this script
SCRIPT_DIR=`dirname $0`
SCRIPT=`$SCRIPT_DIR/realpath $0`
cd `dirname $SCRIPT`
# Process ID
PIDDIR="/var/run"
PIDFILE="$PIDDIR/$APP_NAME.pid"
pid=""
getpid() {
if [ -f $PIDFILE ]
then
if [ -r $PIDFILE ]
then
pid=`cat $PIDFILE`
if [ "X$pid" != "X" ]
then
# Verify that a process with this pid is still running.
pid=`/usr/bin/ps -p $pid | grep $pid | grep -v grep | awk '{print $1}' |
tail -1`
if [ "X$pid" = "X" ]
then
# This is a stale pid file.
rm -f $PIDFILE
echo "Removed stale pid file: $PIDFILE"
fi
fi
else
echo "Cannot read $PIDFILE."
rm -f $PIDFILE
exit 1
fi
fi
}
console() {
echo "Running $APP_LONG_NAME..."
getpid
if [ "X$pid" = "X" ]
then
# If you wanted to specify the priority with which
# your app runs, you could use nice here:
# exec nice -$PRIORITY $WRAPPER_CMD $WRAPPER_CONF wrapper.pidfile=$PIDFILE
# See "man nice" for more details.
exec $WRAPPER_CMD $WRAPPER_CONF wrapper.pidfile=$PIDFILE
else
echo "$APP_LONG_NAME is already running."
exit 1
fi
}
start() {
echo "Starting $APP_LONG_NAME..."
getpid
if [ "X$pid" = "X" ]
then
# If you wanted to specify the priority with which
# your app runs, you could use nice here:
# exec nice -$PRIORITY $WRAPPER_CMD $WRAPPER_CONF wrapper.pidfile=$PIDFILE
wrapper.daemonize=TRUE
# See "man nice" for more details.
exec $WRAPPER_CMD $WRAPPER_CONF wrapper.pidfile=$PIDFILE
wrapper.daemonize=TRUE
else
echo "$APP_LONG_NAME is already running."
exit 1
fi
}
stop() {
echo "Stopping $APP_LONG_NAME..."
getpid
if [ "X$pid" = "X" ]
then
echo "$APP_LONG_NAME was not running."
else
kill $pid
sleep 6
pid=`/usr/bin/ps -p $pid | grep $pid | grep -v grep | awk '{print $1}' |
tail -1`
if [ "X$pid" != "X" ]
then
# SIGTERM didn't work, send SIGKILL.
kill -9 $pid
rm -f $PIDFILE
pid=`/usr/bin/ps -p $pid | grep $pid | grep -v grep | awk '{print $1}' |
tail -1`
fi
if [ "X$pid" != "X" ]
then
echo "Failed to stop $APP_LONG_NAME."
exit 1
else
echo "Stopped $APP_LONG_NAME."
fi
fi
}
dump() {
echo "Dumping $APP_LONG_NAME..."
getpid
if [ "X$pid" = "X" ]
then
echo "$APP_LONG_NAME was not running."
else
kill -3 $pid
if [ $? -ne 0 ]
then
echo "Failed to dump $APP_LONG_NAME."
exit 1
else
echo "Dumped $APP_LONG_NAME."
fi
fi
}
case "$1" in
'console')
console
;;
'start')
start
;;
'stop')
stop
;;
'restart')
stop
start
;;
'dump')
dump
;;
*)
echo "Usage: $0 { console | start | stop | restart | dump }"
exit 1
;;
esac
exit 0
1.1 avalon-phoenix/src/script/Phoenix.bat
Index: Phoenix.bat
===================================================================
@echo off
rem
rem Find the application home.
rem
if "%OS%"=="Windows_NT" goto nt
echo This is not NT, so please edit this script and set _APP_HOME manually
set _APP_HOME=..
goto conf
:nt
rem %~dp0 is name of current script under NT
set _APP_HOME=%~dp0
rem : operator works similar to make : operator
set _APP_HOME=%_APP_HOME:\bin\=%
rem
rem Find the wrapper.conf
rem
:conf
set _WRAPPER_CONF="%~f1"
if not %_WRAPPER_CONF%=="" goto startup
set _WRAPPER_CONF="%_APP_HOME%\conf\wrapper.conf"
rem
rem Run the application.
rem At runtime, the current directory will be that of Wrapper.exe
rem
:startup
"%_APP_HOME%\bin\Wrapper.exe" -c %_WRAPPER_CONF%
if not errorlevel 1 goto end
pause
:end
set _APP_HOME=
set _WRAPPER_CONF=
1.1 avalon-phoenix/src/script/UninstallPhoenix-NT.bat
Index: UninstallPhoenix-NT.bat
===================================================================
@echo off
rem
rem Find the application home.
rem
if "%OS%"=="Windows_NT" goto nt
echo This is not NT, so please edit this script and set _APP_HOME manually
set _APP_HOME=..
goto conf
:nt
rem %~dp0 is name of current script under NT
set _APP_HOME=%~dp0
rem : operator works similar to make : operator
set _APP_HOME=%_APP_HOME:\bin\=%
rem
rem Find the wrapper.conf
rem
:conf
set _WRAPPER_CONF="%~f1"
if not %_WRAPPER_CONF%=="" goto startup
set _WRAPPER_CONF="%_APP_HOME%\conf\wrapper.conf"
rem
rem Run the application.
rem At runtime, the current directory will be that of Wrapper.exe
rem
:startup
"%_APP_HOME%\bin\Wrapper.exe" -r %_WRAPPER_CONF%
if not errorlevel 1 goto end
pause
:end
set _APP_HOME=
set _WRAPPER_CONF=
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]