#! /bin/sh
#
-# Copyright (c) 1999, 2008 Tanuki Software, Inc.
-# http://www.tanukisoftware.com
-# All rights reserved.
-#
-# This software is the confidential and proprietary information
-# of Tanuki Software. ("Confidential Information"). You shall
-# not disclose such Confidential Information and shall use it
-# only in accordance with the terms of the license agreement you
-# entered into with Tanuki Software.
+# Copyright (c) 1999, 2006 Tanuki Software Inc.
#
# Java Service Wrapper sh script. Suitable for starting and stopping
# wrapped Java applications on UNIX platforms.
#-----------------------------------------------------------------------------
# These settings can be modified to fit the needs of your application
-# Optimized for use with version 3.3.0 of the Wrapper.
+
+# Default values for the Application variables, below.
+#
+# NOTE: The build for specific applications may override this during the resource-copying
+# phase, to fill in a concrete name and avoid the use of the defaults specified here.
+DEF_APP_NAME="sonar"
+DEF_APP_LONG_NAME="sonar"
# Application
-APP_NAME="sonar"
-APP_LONG_NAME="sonar"
+APP_NAME="${DEF_APP_NAME}"
+APP_LONG_NAME="${DEF_APP_LONG_NAME}"
# Wrapper
WRAPPER_CMD="./wrapper"
# TERM signals.
#IGNORE_SIGNALS=true
-# Wrapper will start the JVM asynchronously. Your application may have some
-# initialization tasks and it may be desirable to wait a few seconds
-# before returning. For example, to delay the invocation of following
-# startup scripts. Setting WAIT_AFTER_STARTUP to a positive number will
-# cause the start command to delay for the indicated period of time
-# (in seconds).
-#
-WAIT_AFTER_STARTUP=0
-
-# If set, the status, start_msg and stop_msg commands will print out detailed
-# state information on the Wrapper and Java processes.
-#DETAIL_STATUS=true
-
# If specified, the Wrapper will be run as the specified user.
# IMPORTANT - Make sure that the user has the required privileges to write
# the PID file and wrapper.log files. Failure to be able to write the log
# The following two lines are used by the chkconfig command. Change as is
# appropriate for your application. They should remain commented.
# chkconfig: 2345 20 80
-# description: "Sonar Server"
-
-# Initialization block for the install_initd and remove_initd scripts used by
-# SUSE linux distributions.
-### BEGIN INIT INFO
-# Provides: @app.name@
-# Required-Start: $local_fs $network $syslog
-# Should-Start:
-# Required-Stop:
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Short-Description: @app.long.name@
-# Description: @app.description@
-### END INIT INFO
+# description: Test Wrapper Sample Application
# Do not modify anything beyond this point
#-----------------------------------------------------------------------------
# Process ID
ANCHORFILE="$PIDDIR/$APP_NAME.anchor"
-STATUSFILE="$PIDDIR/$APP_NAME.status"
-JAVASTATUSFILE="$PIDDIR/$APP_NAME.java.status"
PIDFILE="$PIDDIR/$APP_NAME.pid"
LOCKDIR="/var/lock/subsys"
LOCKFILE="$LOCKDIR/$APP_NAME"
DIST_OS="solaris"
;;
'hp-ux' | 'hp-ux64')
- # HP-UX needs the XPG4 version of ps (for -o args)
DIST_OS="hpux"
- UNIX95=""
- export UNIX95
;;
'darwin')
DIST_OS="macosx"
esac
# Resolve the architecture
-if [ "$DIST_OS" = "macosx" ]
+DIST_ARCH=`uname -p | tr [:upper:] [:lower:] | tr -d [:blank:]`
+if [ "$DIST_ARCH" = "unknown" ]
then
- DIST_ARCH="universal"
-else
- DIST_ARCH=
- DIST_ARCH=`uname -p 2>/dev/null | tr [:upper:] [:lower:] | tr -d [:blank:]`
- if [ "X$DIST_ARCH" = "X" ]
- then
- DIST_ARCH="unknown"
- fi
- if [ "$DIST_ARCH" = "unknown" ]
- then
- DIST_ARCH=`uname -m 2>/dev/null | tr [:upper:] [:lower:] | tr -d [:blank:]`
- fi
- case "$DIST_ARCH" in
- 'amd64' | 'athlon' | 'i386' | 'i486' | 'i586' | 'i686' | 'x86_64')
- DIST_ARCH="x86"
- ;;
- 'ia32' | 'ia64' | 'ia64n' | 'ia64w')
- DIST_ARCH="ia"
- ;;
- 'ip27')
- DIST_ARCH="mips"
- ;;
- 'power' | 'powerpc' | 'power_pc' | 'ppc64')
- DIST_ARCH="ppc"
- ;;
- 'pa_risc' | 'pa-risc')
- DIST_ARCH="parisc"
- ;;
- 'sun4u' | 'sparcv9')
- DIST_ARCH="sparc"
- ;;
- '9000/800')
- DIST_ARCH="parisc"
- ;;
- esac
-fi
-
-# OSX always places Java in the same location so we can reliably set JAVA_HOME
-if [ "$DIST_OS" = "macosx" ]
-then
- if [ -z "$JAVA_HOME" ]; then
- JAVA_HOME="/Library/Java/Home"; export JAVA_HOME
- fi
+ DIST_ARCH=`uname -m | tr [:upper:] [:lower:] | tr -d [:blank:]`
fi
+case "$DIST_ARCH" in
+ 'amd64' | 'athlon' | 'ia32' | 'ia64' | 'i386' | 'i486' | 'i586' | 'i686' | 'x86_64')
+ DIST_ARCH="x86"
+ ;;
+ 'ip27')
+ DIST_ARCH="mips"
+ ;;
+ 'power' | 'powerpc' | 'power_pc' | 'ppc64')
+ DIST_ARCH="ppc"
+ ;;
+ 'pa_risc' | 'pa-risc')
+ DIST_ARCH="parisc"
+ ;;
+ 'sun4u' | 'sparcv9')
+ DIST_ARCH="sparc"
+ ;;
+ '9000/800')
+ DIST_ARCH="parisc"
+ ;;
+esac
outputFile() {
if [ -f "$1" ]
# If a 32-bit wrapper binary exists then it will work on 32 or 64 bit
# platforms, if the 64-bit binary exists then the distribution most
# likely wants to use long names. Otherwise, look for the default.
+# For macosx, we also want to look for universal binaries.
WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32"
if [ -x "$WRAPPER_TEST_CMD" ]
then
WRAPPER_CMD="$WRAPPER_TEST_CMD"
else
- WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
- if [ -x "$WRAPPER_TEST_CMD" ]
+ if [ "$DIST_OS" = "macosx" ]
then
- WRAPPER_CMD="$WRAPPER_TEST_CMD"
+ WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-universal-32"
+ if [ -x "$WRAPPER_TEST_CMD" ]
+ then
+ WRAPPER_CMD="$WRAPPER_TEST_CMD"
+ else
+ WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
+ if [ -x "$WRAPPER_TEST_CMD" ]
+ then
+ WRAPPER_CMD="$WRAPPER_TEST_CMD"
+ else
+ WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-universal-64"
+ if [ -x "$WRAPPER_TEST_CMD" ]
+ then
+ WRAPPER_CMD="$WRAPPER_TEST_CMD"
+ else
+ if [ ! -x "$WRAPPER_CMD" ]
+ then
+ echo "Unable to locate any of the following binaries:"
+ outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32"
+ outputFile "$WRAPPER_CMD-$DIST_OS-universal-32"
+ outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
+ outputFile "$WRAPPER_CMD-$DIST_OS-universal-64"
+ outputFile "$WRAPPER_CMD"
+ exit 1
+ fi
+ fi
+ fi
+ fi
else
- if [ ! -x "$WRAPPER_CMD" ]
+ WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
+ if [ -x "$WRAPPER_TEST_CMD" ]
then
- echo "Unable to locate any of the following binaries:"
- outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32"
- outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
- outputFile "$WRAPPER_CMD"
- exit 1
+ WRAPPER_CMD="$WRAPPER_TEST_CMD"
+ else
+ if [ ! -x "$WRAPPER_CMD" ]
+ then
+ echo "Unable to locate any of the following binaries:"
+ outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32"
+ outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
+ outputFile "$WRAPPER_CMD"
+ exit 1
+ fi
fi
fi
fi
IGNOREPROP=wrapper.ignore_signals=TRUE
fi
-# Build the status file clause.
-if [ "X$DETAIL_STATUS" = "X" ]
-then
- STATUSPROP=
-else
- STATUSPROP="wrapper.statusfile=\"$STATUSFILE\" wrapper.java.statusfile=\"$JAVASTATUSFILE\""
-fi
-
# Build the lock file clause. Only create a lock file if the lock directory exists on this platform.
LOCKPROP=
if [ -d $LOCKDIR ]
then
if [ "X$1" != "X" ]
then
- # Resolve the primary group
+ # Resolve the primary group
RUN_AS_GROUP=`groups $RUN_AS_USER | awk '{print $3}' | tail -1`
if [ "X$RUN_AS_GROUP" = "X" ]
then
# Still want to change users, recurse. This means that the user will only be
# prompted for a password once. Variables shifted by 1
- #
- # Use "runuser" if this exists. runuser should be used on RedHat in preference to su.
- #
- if test -f "/sbin/runuser"
- then
- /sbin/runuser - $RUN_AS_USER -c "\"$REALPATH\" $2"
- else
- su - $RUN_AS_USER -c "\"$REALPATH\" $2"
- fi
+ su -m $RUN_AS_USER -c "\"$REALPATH\" $2"
# Now that we are the original user again, we may need to clean up the lock file.
if [ "X$LOCKPROP" != "X" ]
}
getpid() {
- pid=""
if [ -f "$PIDFILE" ]
then
if [ -r "$PIDFILE" ]
# common is during system startup after an unclean shutdown.
# The ps statement below looks for the specific wrapper command running as
# the pid. If it is not found then the pid file is considered to be stale.
- case "$DIST_OS" in
- 'macosx')
- pidtest=`$PSEXE -ww -p $pid -o command | grep "$WRAPPER_CMD" | tail -1`
- ;;
- *)
- pidtest=`$PSEXE -p $pid -o args | grep "$WRAPPER_CMD" | tail -1`
- ;;
- esac
-
+ pidtest=`$PSEXE -p $pid -o args | grep "$WRAPPER_CMD" | tail -1`
if [ "X$pidtest" = "X" ]
then
# This is a stale pid file.
fi
}
-getstatus() {
- STATUS=
- if [ -f "$STATUSFILE" ]
- then
- if [ -r "$STATUSFILE" ]
- then
- STATUS=`cat "$STATUSFILE"`
- fi
- fi
- if [ "X$STATUS" = "X" ]
- then
- STATUS="Unknown"
- fi
-
- JAVASTATUS=
- if [ -f "$JAVASTATUSFILE" ]
- then
- if [ -r "$JAVASTATUSFILE" ]
- then
- JAVASTATUS=`cat "$JAVASTATUSFILE"`
- fi
- fi
- if [ "X$JAVASTATUS" = "X" ]
- then
- JAVASTATUS="Unknown"
- fi
-}
-
testpid() {
pid=`$PSEXE -p $pid | grep $pid | grep -v grep | awk '{print $1}' | tail -1`
if [ "X$pid" = "X" ]
if [ "X$pid" = "X" ]
then
# The string passed to eval must handles spaces in paths correctly.
- COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=\"$APP_NAME\" wrapper.pidfile=\"$PIDFILE\" wrapper.name=\"$APP_NAME\" wrapper.displayname=\"$APP_LONG_NAME\" $ANCHORPROP $STATUSPROP $LOCKPROP"
+ COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=$APP_NAME wrapper.pidfile=\"$PIDFILE\" $ANCHORPROP $LOCKPROP"
eval $COMMAND_LINE
else
echo "$APP_LONG_NAME is already running."
exit 1
fi
}
-
+
start() {
- echo -n "Starting $APP_LONG_NAME..."
+ echo "Starting $APP_LONG_NAME..."
getpid
if [ "X$pid" = "X" ]
then
# The string passed to eval must handles spaces in paths correctly.
- COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=\"$APP_NAME\" wrapper.pidfile=\"$PIDFILE\" wrapper.name=\"$APP_NAME\" wrapper.displayname=\"$APP_LONG_NAME\" wrapper.daemonize=TRUE $ANCHORPROP $IGNOREPROP $STATUSPROP $LOCKPROP"
+ COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=$APP_NAME wrapper.pidfile=\"$PIDFILE\" wrapper.daemonize=TRUE $ANCHORPROP $IGNOREPROP $LOCKPROP"
eval $COMMAND_LINE
else
echo "$APP_LONG_NAME is already running."
exit 1
fi
-
- # Sleep for a few seconds to allow for intialization if required
- # then test to make sure we're still running.
- #
- i=0
- while [ $i -lt $WAIT_AFTER_STARTUP ]
- do
- sleep 1
- echo -n "."
- i=`expr $i + 1`
- done
- if [ $WAIT_AFTER_STARTUP -gt 0 ]
+ getpid
+ if [ "X$pid" != "X" ]
then
- getpid
- if [ "X$pid" = "X" ]
- then
- echo " WARNING: $APP_LONG_NAME may have failed to start."
- exit 1
- else
- echo " running ($pid)."
- fi
+ echo "Started $APP_LONG_NAME."
else
- echo ""
- fi
+ echo "Failed to start $APP_LONG_NAME."
+ fi
}
-
+
stopit() {
echo "Stopping $APP_LONG_NAME..."
getpid
echo "$APP_LONG_NAME is not running."
exit 1
else
- if [ "X$DETAIL_STATUS" = "X" ]
- then
- echo "$APP_LONG_NAME is running (PID:$pid)."
- else
- getstatus
- echo "$APP_LONG_NAME is running (PID:$pid, Wrapper:$STATUS, Java:$JAVASTATUS)"
- fi
+ echo "$APP_LONG_NAME is running ($pid)."
exit 0
fi
}
if [ "X$pid" = "X" ]
then
echo "$APP_LONG_NAME was not running."
+
else
kill -3 $pid
fi
}
-# Used by HP-UX init scripts.
-startmsg() {
- getpid
- if [ "X$pid" = "X" ]
- then
- echo "Starting $APP_LONG_NAME... (Wrapper:Stopped)"
- else
- if [ "X$DETAIL_STATUS" = "X" ]
- then
- echo "Starting $APP_LONG_NAME... (Wrapper:Running)"
- else
- getstatus
- echo "Starting $APP_LONG_NAME... (Wrapper:$STATUS, Java:$JAVASTATUS)"
- fi
- fi
-}
-
-# Used by HP-UX init scripts.
-stopmsg() {
- getpid
- if [ "X$pid" = "X" ]
- then
- echo "Stopping $APP_LONG_NAME... (Wrapper:Stopped)"
- else
- if [ "X$DETAIL_STATUS" = "X" ]
- then
- echo "Stopping $APP_LONG_NAME... (Wrapper:Running)"
- else
- getstatus
- echo "Stopping $APP_LONG_NAME... (Wrapper:$STATUS, Java:$JAVASTATUS)"
- fi
- fi
-}
-
case "$1" in
'console')
dump
;;
- 'start_msg')
- checkUser "" $1
- startmsg
- ;;
-
- 'stop_msg')
- checkUser "" $1
- stopmsg
- ;;
-
*)
echo "Usage: $0 { console | start | stop | restart | status | dump }"
exit 1
#! /bin/sh
#
-# Copyright (c) 1999, 2008 Tanuki Software, Inc.
-# http://www.tanukisoftware.com
-# All rights reserved.
-#
-# This software is the confidential and proprietary information
-# of Tanuki Software. ("Confidential Information"). You shall
-# not disclose such Confidential Information and shall use it
-# only in accordance with the terms of the license agreement you
-# entered into with Tanuki Software.
+# Copyright (c) 1999, 2006 Tanuki Software Inc.
#
# Java Service Wrapper sh script. Suitable for starting and stopping
# wrapped Java applications on UNIX platforms.
#-----------------------------------------------------------------------------
# These settings can be modified to fit the needs of your application
-# Optimized for use with version 3.3.0 of the Wrapper.
+
+# Default values for the Application variables, below.
+#
+# NOTE: The build for specific applications may override this during the resource-copying
+# phase, to fill in a concrete name and avoid the use of the defaults specified here.
+DEF_APP_NAME="sonar"
+DEF_APP_LONG_NAME="sonar"
# Application
-APP_NAME="sonar"
-APP_LONG_NAME="sonar"
+APP_NAME="${DEF_APP_NAME}"
+APP_LONG_NAME="${DEF_APP_LONG_NAME}"
# Wrapper
WRAPPER_CMD="./wrapper"
# TERM signals.
#IGNORE_SIGNALS=true
-# Wrapper will start the JVM asynchronously. Your application may have some
-# initialization tasks and it may be desirable to wait a few seconds
-# before returning. For example, to delay the invocation of following
-# startup scripts. Setting WAIT_AFTER_STARTUP to a positive number will
-# cause the start command to delay for the indicated period of time
-# (in seconds).
-#
-WAIT_AFTER_STARTUP=0
-
-# If set, the status, start_msg and stop_msg commands will print out detailed
-# state information on the Wrapper and Java processes.
-#DETAIL_STATUS=true
-
# If specified, the Wrapper will be run as the specified user.
# IMPORTANT - Make sure that the user has the required privileges to write
# the PID file and wrapper.log files. Failure to be able to write the log
# The following two lines are used by the chkconfig command. Change as is
# appropriate for your application. They should remain commented.
# chkconfig: 2345 20 80
-# description: "Sonar Server"
-
-# Initialization block for the install_initd and remove_initd scripts used by
-# SUSE linux distributions.
-### BEGIN INIT INFO
-# Provides: @app.name@
-# Required-Start: $local_fs $network $syslog
-# Should-Start:
-# Required-Stop:
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Short-Description: @app.long.name@
-# Description: @app.description@
-### END INIT INFO
+# description: Test Wrapper Sample Application
# Do not modify anything beyond this point
#-----------------------------------------------------------------------------
# Process ID
ANCHORFILE="$PIDDIR/$APP_NAME.anchor"
-STATUSFILE="$PIDDIR/$APP_NAME.status"
-JAVASTATUSFILE="$PIDDIR/$APP_NAME.java.status"
PIDFILE="$PIDDIR/$APP_NAME.pid"
LOCKDIR="/var/lock/subsys"
LOCKFILE="$LOCKDIR/$APP_NAME"
DIST_OS="solaris"
;;
'hp-ux' | 'hp-ux64')
- # HP-UX needs the XPG4 version of ps (for -o args)
DIST_OS="hpux"
- UNIX95=""
- export UNIX95
;;
'darwin')
DIST_OS="macosx"
esac
# Resolve the architecture
-if [ "$DIST_OS" = "macosx" ]
+DIST_ARCH=`uname -p | tr [:upper:] [:lower:] | tr -d [:blank:]`
+if [ "$DIST_ARCH" = "unknown" ]
then
- DIST_ARCH="universal"
-else
- DIST_ARCH=
- DIST_ARCH=`uname -p 2>/dev/null | tr [:upper:] [:lower:] | tr -d [:blank:]`
- if [ "X$DIST_ARCH" = "X" ]
- then
- DIST_ARCH="unknown"
- fi
- if [ "$DIST_ARCH" = "unknown" ]
- then
- DIST_ARCH=`uname -m 2>/dev/null | tr [:upper:] [:lower:] | tr -d [:blank:]`
- fi
- case "$DIST_ARCH" in
- 'amd64' | 'athlon' | 'i386' | 'i486' | 'i586' | 'i686' | 'x86_64')
- DIST_ARCH="x86"
- ;;
- 'ia32' | 'ia64' | 'ia64n' | 'ia64w')
- DIST_ARCH="ia"
- ;;
- 'ip27')
- DIST_ARCH="mips"
- ;;
- 'power' | 'powerpc' | 'power_pc' | 'ppc64')
- DIST_ARCH="ppc"
- ;;
- 'pa_risc' | 'pa-risc')
- DIST_ARCH="parisc"
- ;;
- 'sun4u' | 'sparcv9')
- DIST_ARCH="sparc"
- ;;
- '9000/800')
- DIST_ARCH="parisc"
- ;;
- esac
-fi
-
-# OSX always places Java in the same location so we can reliably set JAVA_HOME
-if [ "$DIST_OS" = "macosx" ]
-then
- if [ -z "$JAVA_HOME" ]; then
- JAVA_HOME="/Library/Java/Home"; export JAVA_HOME
- fi
+ DIST_ARCH=`uname -m | tr [:upper:] [:lower:] | tr -d [:blank:]`
fi
+case "$DIST_ARCH" in
+ 'amd64' | 'athlon' | 'ia32' | 'ia64' | 'i386' | 'i486' | 'i586' | 'i686' | 'x86_64')
+ DIST_ARCH="x86"
+ ;;
+ 'ip27')
+ DIST_ARCH="mips"
+ ;;
+ 'power' | 'powerpc' | 'power_pc' | 'ppc64')
+ DIST_ARCH="ppc"
+ ;;
+ 'pa_risc' | 'pa-risc')
+ DIST_ARCH="parisc"
+ ;;
+ 'sun4u' | 'sparcv9')
+ DIST_ARCH="sparc"
+ ;;
+ '9000/800')
+ DIST_ARCH="parisc"
+ ;;
+esac
outputFile() {
if [ -f "$1" ]
# If a 32-bit wrapper binary exists then it will work on 32 or 64 bit
# platforms, if the 64-bit binary exists then the distribution most
# likely wants to use long names. Otherwise, look for the default.
+# For macosx, we also want to look for universal binaries.
WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32"
if [ -x "$WRAPPER_TEST_CMD" ]
then
WRAPPER_CMD="$WRAPPER_TEST_CMD"
else
- WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
- if [ -x "$WRAPPER_TEST_CMD" ]
+ if [ "$DIST_OS" = "macosx" ]
then
- WRAPPER_CMD="$WRAPPER_TEST_CMD"
+ WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-universal-32"
+ if [ -x "$WRAPPER_TEST_CMD" ]
+ then
+ WRAPPER_CMD="$WRAPPER_TEST_CMD"
+ else
+ WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
+ if [ -x "$WRAPPER_TEST_CMD" ]
+ then
+ WRAPPER_CMD="$WRAPPER_TEST_CMD"
+ else
+ WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-universal-64"
+ if [ -x "$WRAPPER_TEST_CMD" ]
+ then
+ WRAPPER_CMD="$WRAPPER_TEST_CMD"
+ else
+ if [ ! -x "$WRAPPER_CMD" ]
+ then
+ echo "Unable to locate any of the following binaries:"
+ outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32"
+ outputFile "$WRAPPER_CMD-$DIST_OS-universal-32"
+ outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
+ outputFile "$WRAPPER_CMD-$DIST_OS-universal-64"
+ outputFile "$WRAPPER_CMD"
+ exit 1
+ fi
+ fi
+ fi
+ fi
else
- if [ ! -x "$WRAPPER_CMD" ]
+ WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
+ if [ -x "$WRAPPER_TEST_CMD" ]
then
- echo "Unable to locate any of the following binaries:"
- outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32"
- outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
- outputFile "$WRAPPER_CMD"
- exit 1
+ WRAPPER_CMD="$WRAPPER_TEST_CMD"
+ else
+ if [ ! -x "$WRAPPER_CMD" ]
+ then
+ echo "Unable to locate any of the following binaries:"
+ outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32"
+ outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
+ outputFile "$WRAPPER_CMD"
+ exit 1
+ fi
fi
fi
fi
IGNOREPROP=wrapper.ignore_signals=TRUE
fi
-# Build the status file clause.
-if [ "X$DETAIL_STATUS" = "X" ]
-then
- STATUSPROP=
-else
- STATUSPROP="wrapper.statusfile=\"$STATUSFILE\" wrapper.java.statusfile=\"$JAVASTATUSFILE\""
-fi
-
# Build the lock file clause. Only create a lock file if the lock directory exists on this platform.
LOCKPROP=
if [ -d $LOCKDIR ]
then
if [ "X$1" != "X" ]
then
- # Resolve the primary group
+ # Resolve the primary group
RUN_AS_GROUP=`groups $RUN_AS_USER | awk '{print $3}' | tail -1`
if [ "X$RUN_AS_GROUP" = "X" ]
then
# Still want to change users, recurse. This means that the user will only be
# prompted for a password once. Variables shifted by 1
- #
- # Use "runuser" if this exists. runuser should be used on RedHat in preference to su.
- #
- if test -f "/sbin/runuser"
- then
- /sbin/runuser - $RUN_AS_USER -c "\"$REALPATH\" $2"
- else
- su - $RUN_AS_USER -c "\"$REALPATH\" $2"
- fi
+ su -m $RUN_AS_USER -c "\"$REALPATH\" $2"
# Now that we are the original user again, we may need to clean up the lock file.
if [ "X$LOCKPROP" != "X" ]
}
getpid() {
- pid=""
if [ -f "$PIDFILE" ]
then
if [ -r "$PIDFILE" ]
# common is during system startup after an unclean shutdown.
# The ps statement below looks for the specific wrapper command running as
# the pid. If it is not found then the pid file is considered to be stale.
- case "$DIST_OS" in
- 'macosx')
- pidtest=`$PSEXE -ww -p $pid -o command | grep "$WRAPPER_CMD" | tail -1`
- ;;
- *)
- pidtest=`$PSEXE -p $pid -o args | grep "$WRAPPER_CMD" | tail -1`
- ;;
- esac
-
+ pidtest=`$PSEXE -p $pid -o args | grep "$WRAPPER_CMD" | tail -1`
if [ "X$pidtest" = "X" ]
then
# This is a stale pid file.
fi
}
-getstatus() {
- STATUS=
- if [ -f "$STATUSFILE" ]
- then
- if [ -r "$STATUSFILE" ]
- then
- STATUS=`cat "$STATUSFILE"`
- fi
- fi
- if [ "X$STATUS" = "X" ]
- then
- STATUS="Unknown"
- fi
-
- JAVASTATUS=
- if [ -f "$JAVASTATUSFILE" ]
- then
- if [ -r "$JAVASTATUSFILE" ]
- then
- JAVASTATUS=`cat "$JAVASTATUSFILE"`
- fi
- fi
- if [ "X$JAVASTATUS" = "X" ]
- then
- JAVASTATUS="Unknown"
- fi
-}
-
testpid() {
pid=`$PSEXE -p $pid | grep $pid | grep -v grep | awk '{print $1}' | tail -1`
if [ "X$pid" = "X" ]
if [ "X$pid" = "X" ]
then
# The string passed to eval must handles spaces in paths correctly.
- COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=\"$APP_NAME\" wrapper.pidfile=\"$PIDFILE\" wrapper.name=\"$APP_NAME\" wrapper.displayname=\"$APP_LONG_NAME\" $ANCHORPROP $STATUSPROP $LOCKPROP"
+ COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=$APP_NAME wrapper.pidfile=\"$PIDFILE\" $ANCHORPROP $LOCKPROP"
eval $COMMAND_LINE
else
echo "$APP_LONG_NAME is already running."
exit 1
fi
}
-
+
start() {
- echo -n "Starting $APP_LONG_NAME..."
+ echo "Starting $APP_LONG_NAME..."
getpid
if [ "X$pid" = "X" ]
then
# The string passed to eval must handles spaces in paths correctly.
- COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=\"$APP_NAME\" wrapper.pidfile=\"$PIDFILE\" wrapper.name=\"$APP_NAME\" wrapper.displayname=\"$APP_LONG_NAME\" wrapper.daemonize=TRUE $ANCHORPROP $IGNOREPROP $STATUSPROP $LOCKPROP"
+ COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=$APP_NAME wrapper.pidfile=\"$PIDFILE\" wrapper.daemonize=TRUE $ANCHORPROP $IGNOREPROP $LOCKPROP"
eval $COMMAND_LINE
else
echo "$APP_LONG_NAME is already running."
exit 1
fi
-
- # Sleep for a few seconds to allow for intialization if required
- # then test to make sure we're still running.
- #
- i=0
- while [ $i -lt $WAIT_AFTER_STARTUP ]
- do
- sleep 1
- echo -n "."
- i=`expr $i + 1`
- done
- if [ $WAIT_AFTER_STARTUP -gt 0 ]
+ getpid
+ if [ "X$pid" != "X" ]
then
- getpid
- if [ "X$pid" = "X" ]
- then
- echo " WARNING: $APP_LONG_NAME may have failed to start."
- exit 1
- else
- echo " running ($pid)."
- fi
+ echo "Started $APP_LONG_NAME."
else
- echo ""
- fi
+ echo "Failed to start $APP_LONG_NAME."
+ fi
}
-
+
stopit() {
echo "Stopping $APP_LONG_NAME..."
getpid
echo "$APP_LONG_NAME is not running."
exit 1
else
- if [ "X$DETAIL_STATUS" = "X" ]
- then
- echo "$APP_LONG_NAME is running (PID:$pid)."
- else
- getstatus
- echo "$APP_LONG_NAME is running (PID:$pid, Wrapper:$STATUS, Java:$JAVASTATUS)"
- fi
+ echo "$APP_LONG_NAME is running ($pid)."
exit 0
fi
}
if [ "X$pid" = "X" ]
then
echo "$APP_LONG_NAME was not running."
+
else
kill -3 $pid
fi
}
-# Used by HP-UX init scripts.
-startmsg() {
- getpid
- if [ "X$pid" = "X" ]
- then
- echo "Starting $APP_LONG_NAME... (Wrapper:Stopped)"
- else
- if [ "X$DETAIL_STATUS" = "X" ]
- then
- echo "Starting $APP_LONG_NAME... (Wrapper:Running)"
- else
- getstatus
- echo "Starting $APP_LONG_NAME... (Wrapper:$STATUS, Java:$JAVASTATUS)"
- fi
- fi
-}
-
-# Used by HP-UX init scripts.
-stopmsg() {
- getpid
- if [ "X$pid" = "X" ]
- then
- echo "Stopping $APP_LONG_NAME... (Wrapper:Stopped)"
- else
- if [ "X$DETAIL_STATUS" = "X" ]
- then
- echo "Stopping $APP_LONG_NAME... (Wrapper:Running)"
- else
- getstatus
- echo "Stopping $APP_LONG_NAME... (Wrapper:$STATUS, Java:$JAVASTATUS)"
- fi
- fi
-}
-
case "$1" in
'console')
dump
;;
- 'start_msg')
- checkUser "" $1
- startmsg
- ;;
-
- 'stop_msg')
- checkUser "" $1
- stopmsg
- ;;
-
*)
echo "Usage: $0 { console | start | stop | restart | status | dump }"
exit 1
#! /bin/sh
#
-# Copyright (c) 1999, 2008 Tanuki Software, Inc.
-# http://www.tanukisoftware.com
-# All rights reserved.
-#
-# This software is the confidential and proprietary information
-# of Tanuki Software. ("Confidential Information"). You shall
-# not disclose such Confidential Information and shall use it
-# only in accordance with the terms of the license agreement you
-# entered into with Tanuki Software.
+# Copyright (c) 1999, 2006 Tanuki Software Inc.
#
# Java Service Wrapper sh script. Suitable for starting and stopping
# wrapped Java applications on UNIX platforms.
#-----------------------------------------------------------------------------
# These settings can be modified to fit the needs of your application
-# Optimized for use with version 3.3.0 of the Wrapper.
+
+# Default values for the Application variables, below.
+#
+# NOTE: The build for specific applications may override this during the resource-copying
+# phase, to fill in a concrete name and avoid the use of the defaults specified here.
+DEF_APP_NAME="sonar"
+DEF_APP_LONG_NAME="sonar"
# Application
-APP_NAME="sonar"
-APP_LONG_NAME="sonar"
+APP_NAME="${DEF_APP_NAME}"
+APP_LONG_NAME="${DEF_APP_LONG_NAME}"
# Wrapper
WRAPPER_CMD="./wrapper"
# TERM signals.
#IGNORE_SIGNALS=true
-# Wrapper will start the JVM asynchronously. Your application may have some
-# initialization tasks and it may be desirable to wait a few seconds
-# before returning. For example, to delay the invocation of following
-# startup scripts. Setting WAIT_AFTER_STARTUP to a positive number will
-# cause the start command to delay for the indicated period of time
-# (in seconds).
-#
-WAIT_AFTER_STARTUP=0
-
-# If set, the status, start_msg and stop_msg commands will print out detailed
-# state information on the Wrapper and Java processes.
-#DETAIL_STATUS=true
-
# If specified, the Wrapper will be run as the specified user.
# IMPORTANT - Make sure that the user has the required privileges to write
# the PID file and wrapper.log files. Failure to be able to write the log
# The following two lines are used by the chkconfig command. Change as is
# appropriate for your application. They should remain commented.
# chkconfig: 2345 20 80
-# description: "Sonar Server"
-
-# Initialization block for the install_initd and remove_initd scripts used by
-# SUSE linux distributions.
-### BEGIN INIT INFO
-# Provides: @app.name@
-# Required-Start: $local_fs $network $syslog
-# Should-Start:
-# Required-Stop:
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Short-Description: @app.long.name@
-# Description: @app.description@
-### END INIT INFO
+# description: Test Wrapper Sample Application
# Do not modify anything beyond this point
#-----------------------------------------------------------------------------
# Process ID
ANCHORFILE="$PIDDIR/$APP_NAME.anchor"
-STATUSFILE="$PIDDIR/$APP_NAME.status"
-JAVASTATUSFILE="$PIDDIR/$APP_NAME.java.status"
PIDFILE="$PIDDIR/$APP_NAME.pid"
LOCKDIR="/var/lock/subsys"
LOCKFILE="$LOCKDIR/$APP_NAME"
DIST_OS="solaris"
;;
'hp-ux' | 'hp-ux64')
- # HP-UX needs the XPG4 version of ps (for -o args)
DIST_OS="hpux"
- UNIX95=""
- export UNIX95
;;
'darwin')
DIST_OS="macosx"
esac
# Resolve the architecture
-if [ "$DIST_OS" = "macosx" ]
+DIST_ARCH=`uname -p | tr [:upper:] [:lower:] | tr -d [:blank:]`
+if [ "$DIST_ARCH" = "unknown" ]
then
- DIST_ARCH="universal"
-else
- DIST_ARCH=
- DIST_ARCH=`uname -p 2>/dev/null | tr [:upper:] [:lower:] | tr -d [:blank:]`
- if [ "X$DIST_ARCH" = "X" ]
- then
- DIST_ARCH="unknown"
- fi
- if [ "$DIST_ARCH" = "unknown" ]
- then
- DIST_ARCH=`uname -m 2>/dev/null | tr [:upper:] [:lower:] | tr -d [:blank:]`
- fi
- case "$DIST_ARCH" in
- 'amd64' | 'athlon' | 'i386' | 'i486' | 'i586' | 'i686' | 'x86_64')
- DIST_ARCH="x86"
- ;;
- 'ia32' | 'ia64' | 'ia64n' | 'ia64w')
- DIST_ARCH="ia"
- ;;
- 'ip27')
- DIST_ARCH="mips"
- ;;
- 'power' | 'powerpc' | 'power_pc' | 'ppc64')
- DIST_ARCH="ppc"
- ;;
- 'pa_risc' | 'pa-risc')
- DIST_ARCH="parisc"
- ;;
- 'sun4u' | 'sparcv9')
- DIST_ARCH="sparc"
- ;;
- '9000/800')
- DIST_ARCH="parisc"
- ;;
- esac
-fi
-
-# OSX always places Java in the same location so we can reliably set JAVA_HOME
-if [ "$DIST_OS" = "macosx" ]
-then
- if [ -z "$JAVA_HOME" ]; then
- JAVA_HOME="/Library/Java/Home"; export JAVA_HOME
- fi
+ DIST_ARCH=`uname -m | tr [:upper:] [:lower:] | tr -d [:blank:]`
fi
+case "$DIST_ARCH" in
+ 'amd64' | 'athlon' | 'ia32' | 'ia64' | 'i386' | 'i486' | 'i586' | 'i686' | 'x86_64')
+ DIST_ARCH="x86"
+ ;;
+ 'ip27')
+ DIST_ARCH="mips"
+ ;;
+ 'power' | 'powerpc' | 'power_pc' | 'ppc64')
+ DIST_ARCH="ppc"
+ ;;
+ 'pa_risc' | 'pa-risc')
+ DIST_ARCH="parisc"
+ ;;
+ 'sun4u' | 'sparcv9')
+ DIST_ARCH="sparc"
+ ;;
+ '9000/800')
+ DIST_ARCH="parisc"
+ ;;
+esac
outputFile() {
if [ -f "$1" ]
# If a 32-bit wrapper binary exists then it will work on 32 or 64 bit
# platforms, if the 64-bit binary exists then the distribution most
# likely wants to use long names. Otherwise, look for the default.
+# For macosx, we also want to look for universal binaries.
WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32"
if [ -x "$WRAPPER_TEST_CMD" ]
then
WRAPPER_CMD="$WRAPPER_TEST_CMD"
else
- WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
- if [ -x "$WRAPPER_TEST_CMD" ]
+ if [ "$DIST_OS" = "macosx" ]
then
- WRAPPER_CMD="$WRAPPER_TEST_CMD"
+ WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-universal-32"
+ if [ -x "$WRAPPER_TEST_CMD" ]
+ then
+ WRAPPER_CMD="$WRAPPER_TEST_CMD"
+ else
+ WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
+ if [ -x "$WRAPPER_TEST_CMD" ]
+ then
+ WRAPPER_CMD="$WRAPPER_TEST_CMD"
+ else
+ WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-universal-64"
+ if [ -x "$WRAPPER_TEST_CMD" ]
+ then
+ WRAPPER_CMD="$WRAPPER_TEST_CMD"
+ else
+ if [ ! -x "$WRAPPER_CMD" ]
+ then
+ echo "Unable to locate any of the following binaries:"
+ outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32"
+ outputFile "$WRAPPER_CMD-$DIST_OS-universal-32"
+ outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
+ outputFile "$WRAPPER_CMD-$DIST_OS-universal-64"
+ outputFile "$WRAPPER_CMD"
+ exit 1
+ fi
+ fi
+ fi
+ fi
else
- if [ ! -x "$WRAPPER_CMD" ]
+ WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
+ if [ -x "$WRAPPER_TEST_CMD" ]
then
- echo "Unable to locate any of the following binaries:"
- outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32"
- outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
- outputFile "$WRAPPER_CMD"
- exit 1
+ WRAPPER_CMD="$WRAPPER_TEST_CMD"
+ else
+ if [ ! -x "$WRAPPER_CMD" ]
+ then
+ echo "Unable to locate any of the following binaries:"
+ outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32"
+ outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
+ outputFile "$WRAPPER_CMD"
+ exit 1
+ fi
fi
fi
fi
IGNOREPROP=wrapper.ignore_signals=TRUE
fi
-# Build the status file clause.
-if [ "X$DETAIL_STATUS" = "X" ]
-then
- STATUSPROP=
-else
- STATUSPROP="wrapper.statusfile=\"$STATUSFILE\" wrapper.java.statusfile=\"$JAVASTATUSFILE\""
-fi
-
# Build the lock file clause. Only create a lock file if the lock directory exists on this platform.
LOCKPROP=
if [ -d $LOCKDIR ]
then
if [ "X$1" != "X" ]
then
- # Resolve the primary group
+ # Resolve the primary group
RUN_AS_GROUP=`groups $RUN_AS_USER | awk '{print $3}' | tail -1`
if [ "X$RUN_AS_GROUP" = "X" ]
then
# Still want to change users, recurse. This means that the user will only be
# prompted for a password once. Variables shifted by 1
- #
- # Use "runuser" if this exists. runuser should be used on RedHat in preference to su.
- #
- if test -f "/sbin/runuser"
- then
- /sbin/runuser - $RUN_AS_USER -c "\"$REALPATH\" $2"
- else
- su - $RUN_AS_USER -c "\"$REALPATH\" $2"
- fi
+ su -m $RUN_AS_USER -c "\"$REALPATH\" $2"
# Now that we are the original user again, we may need to clean up the lock file.
if [ "X$LOCKPROP" != "X" ]
}
getpid() {
- pid=""
if [ -f "$PIDFILE" ]
then
if [ -r "$PIDFILE" ]
# common is during system startup after an unclean shutdown.
# The ps statement below looks for the specific wrapper command running as
# the pid. If it is not found then the pid file is considered to be stale.
- case "$DIST_OS" in
- 'macosx')
- pidtest=`$PSEXE -ww -p $pid -o command | grep "$WRAPPER_CMD" | tail -1`
- ;;
- *)
- pidtest=`$PSEXE -p $pid -o args | grep "$WRAPPER_CMD" | tail -1`
- ;;
- esac
-
+ pidtest=`$PSEXE -p $pid -o args | grep "$WRAPPER_CMD" | tail -1`
if [ "X$pidtest" = "X" ]
then
# This is a stale pid file.
fi
}
-getstatus() {
- STATUS=
- if [ -f "$STATUSFILE" ]
- then
- if [ -r "$STATUSFILE" ]
- then
- STATUS=`cat "$STATUSFILE"`
- fi
- fi
- if [ "X$STATUS" = "X" ]
- then
- STATUS="Unknown"
- fi
-
- JAVASTATUS=
- if [ -f "$JAVASTATUSFILE" ]
- then
- if [ -r "$JAVASTATUSFILE" ]
- then
- JAVASTATUS=`cat "$JAVASTATUSFILE"`
- fi
- fi
- if [ "X$JAVASTATUS" = "X" ]
- then
- JAVASTATUS="Unknown"
- fi
-}
-
testpid() {
pid=`$PSEXE -p $pid | grep $pid | grep -v grep | awk '{print $1}' | tail -1`
if [ "X$pid" = "X" ]
if [ "X$pid" = "X" ]
then
# The string passed to eval must handles spaces in paths correctly.
- COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=\"$APP_NAME\" wrapper.pidfile=\"$PIDFILE\" wrapper.name=\"$APP_NAME\" wrapper.displayname=\"$APP_LONG_NAME\" $ANCHORPROP $STATUSPROP $LOCKPROP"
+ COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=$APP_NAME wrapper.pidfile=\"$PIDFILE\" $ANCHORPROP $LOCKPROP"
eval $COMMAND_LINE
else
echo "$APP_LONG_NAME is already running."
exit 1
fi
}
-
+
start() {
- echo -n "Starting $APP_LONG_NAME..."
+ echo "Starting $APP_LONG_NAME..."
getpid
if [ "X$pid" = "X" ]
then
# The string passed to eval must handles spaces in paths correctly.
- COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=\"$APP_NAME\" wrapper.pidfile=\"$PIDFILE\" wrapper.name=\"$APP_NAME\" wrapper.displayname=\"$APP_LONG_NAME\" wrapper.daemonize=TRUE $ANCHORPROP $IGNOREPROP $STATUSPROP $LOCKPROP"
+ COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=$APP_NAME wrapper.pidfile=\"$PIDFILE\" wrapper.daemonize=TRUE $ANCHORPROP $IGNOREPROP $LOCKPROP"
eval $COMMAND_LINE
else
echo "$APP_LONG_NAME is already running."
exit 1
fi
-
- # Sleep for a few seconds to allow for intialization if required
- # then test to make sure we're still running.
- #
- i=0
- while [ $i -lt $WAIT_AFTER_STARTUP ]
- do
- sleep 1
- echo -n "."
- i=`expr $i + 1`
- done
- if [ $WAIT_AFTER_STARTUP -gt 0 ]
+ getpid
+ if [ "X$pid" != "X" ]
then
- getpid
- if [ "X$pid" = "X" ]
- then
- echo " WARNING: $APP_LONG_NAME may have failed to start."
- exit 1
- else
- echo " running ($pid)."
- fi
+ echo "Started $APP_LONG_NAME."
else
- echo ""
- fi
+ echo "Failed to start $APP_LONG_NAME."
+ fi
}
-
+
stopit() {
echo "Stopping $APP_LONG_NAME..."
getpid
echo "$APP_LONG_NAME is not running."
exit 1
else
- if [ "X$DETAIL_STATUS" = "X" ]
- then
- echo "$APP_LONG_NAME is running (PID:$pid)."
- else
- getstatus
- echo "$APP_LONG_NAME is running (PID:$pid, Wrapper:$STATUS, Java:$JAVASTATUS)"
- fi
+ echo "$APP_LONG_NAME is running ($pid)."
exit 0
fi
}
if [ "X$pid" = "X" ]
then
echo "$APP_LONG_NAME was not running."
+
else
kill -3 $pid
fi
}
-# Used by HP-UX init scripts.
-startmsg() {
- getpid
- if [ "X$pid" = "X" ]
- then
- echo "Starting $APP_LONG_NAME... (Wrapper:Stopped)"
- else
- if [ "X$DETAIL_STATUS" = "X" ]
- then
- echo "Starting $APP_LONG_NAME... (Wrapper:Running)"
- else
- getstatus
- echo "Starting $APP_LONG_NAME... (Wrapper:$STATUS, Java:$JAVASTATUS)"
- fi
- fi
-}
-
-# Used by HP-UX init scripts.
-stopmsg() {
- getpid
- if [ "X$pid" = "X" ]
- then
- echo "Stopping $APP_LONG_NAME... (Wrapper:Stopped)"
- else
- if [ "X$DETAIL_STATUS" = "X" ]
- then
- echo "Stopping $APP_LONG_NAME... (Wrapper:Running)"
- else
- getstatus
- echo "Stopping $APP_LONG_NAME... (Wrapper:$STATUS, Java:$JAVASTATUS)"
- fi
- fi
-}
-
case "$1" in
'console')
dump
;;
- 'start_msg')
- checkUser "" $1
- startmsg
- ;;
-
- 'stop_msg')
- checkUser "" $1
- stopmsg
- ;;
-
*)
echo "Usage: $0 { console | start | stop | restart | status | dump }"
exit 1
#! /bin/sh
#
-# Copyright (c) 1999, 2008 Tanuki Software, Inc.
-# http://www.tanukisoftware.com
-# All rights reserved.
-#
-# This software is the confidential and proprietary information
-# of Tanuki Software. ("Confidential Information"). You shall
-# not disclose such Confidential Information and shall use it
-# only in accordance with the terms of the license agreement you
-# entered into with Tanuki Software.
+# Copyright (c) 1999, 2006 Tanuki Software Inc.
#
# Java Service Wrapper sh script. Suitable for starting and stopping
# wrapped Java applications on UNIX platforms.
#-----------------------------------------------------------------------------
# These settings can be modified to fit the needs of your application
-# Optimized for use with version 3.3.0 of the Wrapper.
+
+# Default values for the Application variables, below.
+#
+# NOTE: The build for specific applications may override this during the resource-copying
+# phase, to fill in a concrete name and avoid the use of the defaults specified here.
+DEF_APP_NAME="sonar"
+DEF_APP_LONG_NAME="sonar"
# Application
-APP_NAME="sonar"
-APP_LONG_NAME="sonar"
+APP_NAME="${DEF_APP_NAME}"
+APP_LONG_NAME="${DEF_APP_LONG_NAME}"
# Wrapper
WRAPPER_CMD="./wrapper"
# TERM signals.
#IGNORE_SIGNALS=true
-# Wrapper will start the JVM asynchronously. Your application may have some
-# initialization tasks and it may be desirable to wait a few seconds
-# before returning. For example, to delay the invocation of following
-# startup scripts. Setting WAIT_AFTER_STARTUP to a positive number will
-# cause the start command to delay for the indicated period of time
-# (in seconds).
-#
-WAIT_AFTER_STARTUP=0
-
-# If set, the status, start_msg and stop_msg commands will print out detailed
-# state information on the Wrapper and Java processes.
-#DETAIL_STATUS=true
-
# If specified, the Wrapper will be run as the specified user.
# IMPORTANT - Make sure that the user has the required privileges to write
# the PID file and wrapper.log files. Failure to be able to write the log
# The following two lines are used by the chkconfig command. Change as is
# appropriate for your application. They should remain commented.
# chkconfig: 2345 20 80
-# description: "Sonar Server"
-
-# Initialization block for the install_initd and remove_initd scripts used by
-# SUSE linux distributions.
-### BEGIN INIT INFO
-# Provides: @app.name@
-# Required-Start: $local_fs $network $syslog
-# Should-Start:
-# Required-Stop:
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Short-Description: @app.long.name@
-# Description: @app.description@
-### END INIT INFO
+# description: Test Wrapper Sample Application
# Do not modify anything beyond this point
#-----------------------------------------------------------------------------
# Process ID
ANCHORFILE="$PIDDIR/$APP_NAME.anchor"
-STATUSFILE="$PIDDIR/$APP_NAME.status"
-JAVASTATUSFILE="$PIDDIR/$APP_NAME.java.status"
PIDFILE="$PIDDIR/$APP_NAME.pid"
LOCKDIR="/var/lock/subsys"
LOCKFILE="$LOCKDIR/$APP_NAME"
DIST_OS="solaris"
;;
'hp-ux' | 'hp-ux64')
- # HP-UX needs the XPG4 version of ps (for -o args)
DIST_OS="hpux"
- UNIX95=""
- export UNIX95
;;
'darwin')
DIST_OS="macosx"
esac
# Resolve the architecture
-if [ "$DIST_OS" = "macosx" ]
+DIST_ARCH=`uname -p | tr [:upper:] [:lower:] | tr -d [:blank:]`
+if [ "$DIST_ARCH" = "unknown" ]
then
- DIST_ARCH="universal"
-else
- DIST_ARCH=
- DIST_ARCH=`uname -p 2>/dev/null | tr [:upper:] [:lower:] | tr -d [:blank:]`
- if [ "X$DIST_ARCH" = "X" ]
- then
- DIST_ARCH="unknown"
- fi
- if [ "$DIST_ARCH" = "unknown" ]
- then
- DIST_ARCH=`uname -m 2>/dev/null | tr [:upper:] [:lower:] | tr -d [:blank:]`
- fi
- case "$DIST_ARCH" in
- 'amd64' | 'athlon' | 'i386' | 'i486' | 'i586' | 'i686' | 'x86_64')
- DIST_ARCH="x86"
- ;;
- 'ia32' | 'ia64' | 'ia64n' | 'ia64w')
- DIST_ARCH="ia"
- ;;
- 'ip27')
- DIST_ARCH="mips"
- ;;
- 'power' | 'powerpc' | 'power_pc' | 'ppc64')
- DIST_ARCH="ppc"
- ;;
- 'pa_risc' | 'pa-risc')
- DIST_ARCH="parisc"
- ;;
- 'sun4u' | 'sparcv9')
- DIST_ARCH="sparc"
- ;;
- '9000/800')
- DIST_ARCH="parisc"
- ;;
- esac
-fi
-
-# OSX always places Java in the same location so we can reliably set JAVA_HOME
-if [ "$DIST_OS" = "macosx" ]
-then
- if [ -z "$JAVA_HOME" ]; then
- JAVA_HOME="/Library/Java/Home"; export JAVA_HOME
- fi
+ DIST_ARCH=`uname -m | tr [:upper:] [:lower:] | tr -d [:blank:]`
fi
+case "$DIST_ARCH" in
+ 'amd64' | 'athlon' | 'ia32' | 'ia64' | 'i386' | 'i486' | 'i586' | 'i686' | 'x86_64')
+ DIST_ARCH="x86"
+ ;;
+ 'ip27')
+ DIST_ARCH="mips"
+ ;;
+ 'power' | 'powerpc' | 'power_pc' | 'ppc64')
+ DIST_ARCH="ppc"
+ ;;
+ 'pa_risc' | 'pa-risc')
+ DIST_ARCH="parisc"
+ ;;
+ 'sun4u' | 'sparcv9')
+ DIST_ARCH="sparc"
+ ;;
+ '9000/800')
+ DIST_ARCH="parisc"
+ ;;
+esac
outputFile() {
if [ -f "$1" ]
# If a 32-bit wrapper binary exists then it will work on 32 or 64 bit
# platforms, if the 64-bit binary exists then the distribution most
# likely wants to use long names. Otherwise, look for the default.
+# For macosx, we also want to look for universal binaries.
WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32"
if [ -x "$WRAPPER_TEST_CMD" ]
then
WRAPPER_CMD="$WRAPPER_TEST_CMD"
else
- WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
- if [ -x "$WRAPPER_TEST_CMD" ]
+ if [ "$DIST_OS" = "macosx" ]
then
- WRAPPER_CMD="$WRAPPER_TEST_CMD"
+ WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-universal-32"
+ if [ -x "$WRAPPER_TEST_CMD" ]
+ then
+ WRAPPER_CMD="$WRAPPER_TEST_CMD"
+ else
+ WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
+ if [ -x "$WRAPPER_TEST_CMD" ]
+ then
+ WRAPPER_CMD="$WRAPPER_TEST_CMD"
+ else
+ WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-universal-64"
+ if [ -x "$WRAPPER_TEST_CMD" ]
+ then
+ WRAPPER_CMD="$WRAPPER_TEST_CMD"
+ else
+ if [ ! -x "$WRAPPER_CMD" ]
+ then
+ echo "Unable to locate any of the following binaries:"
+ outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32"
+ outputFile "$WRAPPER_CMD-$DIST_OS-universal-32"
+ outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
+ outputFile "$WRAPPER_CMD-$DIST_OS-universal-64"
+ outputFile "$WRAPPER_CMD"
+ exit 1
+ fi
+ fi
+ fi
+ fi
else
- if [ ! -x "$WRAPPER_CMD" ]
+ WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
+ if [ -x "$WRAPPER_TEST_CMD" ]
then
- echo "Unable to locate any of the following binaries:"
- outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32"
- outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
- outputFile "$WRAPPER_CMD"
- exit 1
+ WRAPPER_CMD="$WRAPPER_TEST_CMD"
+ else
+ if [ ! -x "$WRAPPER_CMD" ]
+ then
+ echo "Unable to locate any of the following binaries:"
+ outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32"
+ outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
+ outputFile "$WRAPPER_CMD"
+ exit 1
+ fi
fi
fi
fi
IGNOREPROP=wrapper.ignore_signals=TRUE
fi
-# Build the status file clause.
-if [ "X$DETAIL_STATUS" = "X" ]
-then
- STATUSPROP=
-else
- STATUSPROP="wrapper.statusfile=\"$STATUSFILE\" wrapper.java.statusfile=\"$JAVASTATUSFILE\""
-fi
-
# Build the lock file clause. Only create a lock file if the lock directory exists on this platform.
LOCKPROP=
if [ -d $LOCKDIR ]
then
if [ "X$1" != "X" ]
then
- # Resolve the primary group
+ # Resolve the primary group
RUN_AS_GROUP=`groups $RUN_AS_USER | awk '{print $3}' | tail -1`
if [ "X$RUN_AS_GROUP" = "X" ]
then
# Still want to change users, recurse. This means that the user will only be
# prompted for a password once. Variables shifted by 1
- #
- # Use "runuser" if this exists. runuser should be used on RedHat in preference to su.
- #
- if test -f "/sbin/runuser"
- then
- /sbin/runuser - $RUN_AS_USER -c "\"$REALPATH\" $2"
- else
- su - $RUN_AS_USER -c "\"$REALPATH\" $2"
- fi
+ su -m $RUN_AS_USER -c "\"$REALPATH\" $2"
# Now that we are the original user again, we may need to clean up the lock file.
if [ "X$LOCKPROP" != "X" ]
}
getpid() {
- pid=""
if [ -f "$PIDFILE" ]
then
if [ -r "$PIDFILE" ]
pidtest=`$PSEXE -p $pid -o args | grep "$WRAPPER_CMD" | tail -1`
;;
esac
-
if [ "X$pidtest" = "X" ]
then
# This is a stale pid file.
fi
}
-getstatus() {
- STATUS=
- if [ -f "$STATUSFILE" ]
- then
- if [ -r "$STATUSFILE" ]
- then
- STATUS=`cat "$STATUSFILE"`
- fi
- fi
- if [ "X$STATUS" = "X" ]
- then
- STATUS="Unknown"
- fi
-
- JAVASTATUS=
- if [ -f "$JAVASTATUSFILE" ]
- then
- if [ -r "$JAVASTATUSFILE" ]
- then
- JAVASTATUS=`cat "$JAVASTATUSFILE"`
- fi
- fi
- if [ "X$JAVASTATUS" = "X" ]
- then
- JAVASTATUS="Unknown"
- fi
-}
-
testpid() {
pid=`$PSEXE -p $pid | grep $pid | grep -v grep | awk '{print $1}' | tail -1`
if [ "X$pid" = "X" ]
if [ "X$pid" = "X" ]
then
# The string passed to eval must handles spaces in paths correctly.
- COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=\"$APP_NAME\" wrapper.pidfile=\"$PIDFILE\" wrapper.name=\"$APP_NAME\" wrapper.displayname=\"$APP_LONG_NAME\" $ANCHORPROP $STATUSPROP $LOCKPROP"
+ COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=$APP_NAME wrapper.pidfile=\"$PIDFILE\" $ANCHORPROP $LOCKPROP"
eval $COMMAND_LINE
else
echo "$APP_LONG_NAME is already running."
exit 1
fi
}
-
+
start() {
- echo -n "Starting $APP_LONG_NAME..."
+ echo "Starting $APP_LONG_NAME..."
getpid
if [ "X$pid" = "X" ]
then
# The string passed to eval must handles spaces in paths correctly.
- COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=\"$APP_NAME\" wrapper.pidfile=\"$PIDFILE\" wrapper.name=\"$APP_NAME\" wrapper.displayname=\"$APP_LONG_NAME\" wrapper.daemonize=TRUE $ANCHORPROP $IGNOREPROP $STATUSPROP $LOCKPROP"
+ COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=$APP_NAME wrapper.pidfile=\"$PIDFILE\" wrapper.daemonize=TRUE $ANCHORPROP $IGNOREPROP $LOCKPROP"
eval $COMMAND_LINE
else
echo "$APP_LONG_NAME is already running."
exit 1
fi
-
- # Sleep for a few seconds to allow for intialization if required
- # then test to make sure we're still running.
- #
- i=0
- while [ $i -lt $WAIT_AFTER_STARTUP ]
- do
- sleep 1
- echo -n "."
- i=`expr $i + 1`
- done
- if [ $WAIT_AFTER_STARTUP -gt 0 ]
+ getpid
+ if [ "X$pid" != "X" ]
then
- getpid
- if [ "X$pid" = "X" ]
- then
- echo " WARNING: $APP_LONG_NAME may have failed to start."
- exit 1
- else
- echo " running ($pid)."
- fi
+ echo "Started $APP_LONG_NAME."
else
- echo ""
- fi
+ echo "Failed to start $APP_LONG_NAME."
+ fi
}
-
+
stopit() {
echo "Stopping $APP_LONG_NAME..."
getpid
echo "$APP_LONG_NAME is not running."
exit 1
else
- if [ "X$DETAIL_STATUS" = "X" ]
- then
- echo "$APP_LONG_NAME is running (PID:$pid)."
- else
- getstatus
- echo "$APP_LONG_NAME is running (PID:$pid, Wrapper:$STATUS, Java:$JAVASTATUS)"
- fi
+ echo "$APP_LONG_NAME is running ($pid)."
exit 0
fi
}
if [ "X$pid" = "X" ]
then
echo "$APP_LONG_NAME was not running."
+
else
kill -3 $pid
fi
}
-# Used by HP-UX init scripts.
-startmsg() {
- getpid
- if [ "X$pid" = "X" ]
- then
- echo "Starting $APP_LONG_NAME... (Wrapper:Stopped)"
- else
- if [ "X$DETAIL_STATUS" = "X" ]
- then
- echo "Starting $APP_LONG_NAME... (Wrapper:Running)"
- else
- getstatus
- echo "Starting $APP_LONG_NAME... (Wrapper:$STATUS, Java:$JAVASTATUS)"
- fi
- fi
-}
-
-# Used by HP-UX init scripts.
-stopmsg() {
- getpid
- if [ "X$pid" = "X" ]
- then
- echo "Stopping $APP_LONG_NAME... (Wrapper:Stopped)"
- else
- if [ "X$DETAIL_STATUS" = "X" ]
- then
- echo "Stopping $APP_LONG_NAME... (Wrapper:Running)"
- else
- getstatus
- echo "Stopping $APP_LONG_NAME... (Wrapper:$STATUS, Java:$JAVASTATUS)"
- fi
- fi
-}
-
case "$1" in
'console')
dump
;;
- 'start_msg')
- checkUser "" $1
- startmsg
- ;;
-
- 'stop_msg')
- checkUser "" $1
- stopmsg
- ;;
-
*)
echo "Usage: $0 { console | start | stop | restart | status | dump }"
exit 1
#! /bin/sh
#
-# Copyright (c) 1999, 2008 Tanuki Software, Inc.
-# http://www.tanukisoftware.com
-# All rights reserved.
-#
-# This software is the confidential and proprietary information
-# of Tanuki Software. ("Confidential Information"). You shall
-# not disclose such Confidential Information and shall use it
-# only in accordance with the terms of the license agreement you
-# entered into with Tanuki Software.
+# Copyright (c) 1999, 2006 Tanuki Software Inc.
#
# Java Service Wrapper sh script. Suitable for starting and stopping
# wrapped Java applications on UNIX platforms.
#-----------------------------------------------------------------------------
# These settings can be modified to fit the needs of your application
-# Optimized for use with version 3.3.0 of the Wrapper.
+
+# Default values for the Application variables, below.
+#
+# NOTE: The build for specific applications may override this during the resource-copying
+# phase, to fill in a concrete name and avoid the use of the defaults specified here.
+DEF_APP_NAME="sonar"
+DEF_APP_LONG_NAME="sonar"
# Application
-APP_NAME="sonar"
-APP_LONG_NAME="sonar"
+APP_NAME="${DEF_APP_NAME}"
+APP_LONG_NAME="${DEF_APP_LONG_NAME}"
# Wrapper
WRAPPER_CMD="./wrapper"
# TERM signals.
#IGNORE_SIGNALS=true
-# Wrapper will start the JVM asynchronously. Your application may have some
-# initialization tasks and it may be desirable to wait a few seconds
-# before returning. For example, to delay the invocation of following
-# startup scripts. Setting WAIT_AFTER_STARTUP to a positive number will
-# cause the start command to delay for the indicated period of time
-# (in seconds).
-#
-WAIT_AFTER_STARTUP=0
-
-# If set, the status, start_msg and stop_msg commands will print out detailed
-# state information on the Wrapper and Java processes.
-#DETAIL_STATUS=true
-
# If specified, the Wrapper will be run as the specified user.
# IMPORTANT - Make sure that the user has the required privileges to write
# the PID file and wrapper.log files. Failure to be able to write the log
# The following two lines are used by the chkconfig command. Change as is
# appropriate for your application. They should remain commented.
# chkconfig: 2345 20 80
-# description: "Sonar Server"
-
-# Initialization block for the install_initd and remove_initd scripts used by
-# SUSE linux distributions.
-### BEGIN INIT INFO
-# Provides: @app.name@
-# Required-Start: $local_fs $network $syslog
-# Should-Start:
-# Required-Stop:
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Short-Description: @app.long.name@
-# Description: @app.description@
-### END INIT INFO
+# description: Test Wrapper Sample Application
# Do not modify anything beyond this point
#-----------------------------------------------------------------------------
# Process ID
ANCHORFILE="$PIDDIR/$APP_NAME.anchor"
-STATUSFILE="$PIDDIR/$APP_NAME.status"
-JAVASTATUSFILE="$PIDDIR/$APP_NAME.java.status"
PIDFILE="$PIDDIR/$APP_NAME.pid"
LOCKDIR="/var/lock/subsys"
LOCKFILE="$LOCKDIR/$APP_NAME"
DIST_OS="solaris"
;;
'hp-ux' | 'hp-ux64')
- # HP-UX needs the XPG4 version of ps (for -o args)
DIST_OS="hpux"
- UNIX95=""
- export UNIX95
;;
'darwin')
DIST_OS="macosx"
esac
# Resolve the architecture
-if [ "$DIST_OS" = "macosx" ]
+DIST_ARCH=`uname -p | tr [:upper:] [:lower:] | tr -d [:blank:]`
+if [ "$DIST_ARCH" = "unknown" ]
then
- DIST_ARCH="universal"
-else
- DIST_ARCH=
- DIST_ARCH=`uname -p 2>/dev/null | tr [:upper:] [:lower:] | tr -d [:blank:]`
- if [ "X$DIST_ARCH" = "X" ]
- then
- DIST_ARCH="unknown"
- fi
- if [ "$DIST_ARCH" = "unknown" ]
- then
- DIST_ARCH=`uname -m 2>/dev/null | tr [:upper:] [:lower:] | tr -d [:blank:]`
- fi
- case "$DIST_ARCH" in
- 'amd64' | 'athlon' | 'i386' | 'i486' | 'i586' | 'i686' | 'x86_64')
- DIST_ARCH="x86"
- ;;
- 'ia32' | 'ia64' | 'ia64n' | 'ia64w')
- DIST_ARCH="ia"
- ;;
- 'ip27')
- DIST_ARCH="mips"
- ;;
- 'power' | 'powerpc' | 'power_pc' | 'ppc64')
- DIST_ARCH="ppc"
- ;;
- 'pa_risc' | 'pa-risc')
- DIST_ARCH="parisc"
- ;;
- 'sun4u' | 'sparcv9')
- DIST_ARCH="sparc"
- ;;
- '9000/800')
- DIST_ARCH="parisc"
- ;;
- esac
-fi
-
-# OSX always places Java in the same location so we can reliably set JAVA_HOME
-if [ "$DIST_OS" = "macosx" ]
-then
- if [ -z "$JAVA_HOME" ]; then
- JAVA_HOME="/Library/Java/Home"; export JAVA_HOME
- fi
+ DIST_ARCH=`uname -m | tr [:upper:] [:lower:] | tr -d [:blank:]`
fi
+case "$DIST_ARCH" in
+ 'amd64' | 'athlon' | 'ia32' | 'ia64' | 'i386' | 'i486' | 'i586' | 'i686' | 'x86_64')
+ DIST_ARCH="x86"
+ ;;
+ 'ip27')
+ DIST_ARCH="mips"
+ ;;
+ 'power' | 'powerpc' | 'power_pc' | 'ppc64')
+ DIST_ARCH="ppc"
+ ;;
+ 'pa_risc' | 'pa-risc')
+ DIST_ARCH="parisc"
+ ;;
+ 'sun4u' | 'sparcv9')
+ DIST_ARCH="sparc"
+ ;;
+ '9000/800')
+ DIST_ARCH="parisc"
+ ;;
+esac
outputFile() {
if [ -f "$1" ]
# If a 32-bit wrapper binary exists then it will work on 32 or 64 bit
# platforms, if the 64-bit binary exists then the distribution most
# likely wants to use long names. Otherwise, look for the default.
+# For macosx, we also want to look for universal binaries.
WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32"
if [ -x "$WRAPPER_TEST_CMD" ]
then
WRAPPER_CMD="$WRAPPER_TEST_CMD"
else
- WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
- if [ -x "$WRAPPER_TEST_CMD" ]
+ if [ "$DIST_OS" = "macosx" ]
then
- WRAPPER_CMD="$WRAPPER_TEST_CMD"
+ WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-universal-32"
+ if [ -x "$WRAPPER_TEST_CMD" ]
+ then
+ WRAPPER_CMD="$WRAPPER_TEST_CMD"
+ else
+ WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
+ if [ -x "$WRAPPER_TEST_CMD" ]
+ then
+ WRAPPER_CMD="$WRAPPER_TEST_CMD"
+ else
+ WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-universal-64"
+ if [ -x "$WRAPPER_TEST_CMD" ]
+ then
+ WRAPPER_CMD="$WRAPPER_TEST_CMD"
+ else
+ if [ ! -x "$WRAPPER_CMD" ]
+ then
+ echo "Unable to locate any of the following binaries:"
+ outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32"
+ outputFile "$WRAPPER_CMD-$DIST_OS-universal-32"
+ outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
+ outputFile "$WRAPPER_CMD-$DIST_OS-universal-64"
+ outputFile "$WRAPPER_CMD"
+ exit 1
+ fi
+ fi
+ fi
+ fi
else
- if [ ! -x "$WRAPPER_CMD" ]
+ WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
+ if [ -x "$WRAPPER_TEST_CMD" ]
then
- echo "Unable to locate any of the following binaries:"
- outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32"
- outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
- outputFile "$WRAPPER_CMD"
- exit 1
+ WRAPPER_CMD="$WRAPPER_TEST_CMD"
+ else
+ if [ ! -x "$WRAPPER_CMD" ]
+ then
+ echo "Unable to locate any of the following binaries:"
+ outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32"
+ outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
+ outputFile "$WRAPPER_CMD"
+ exit 1
+ fi
fi
fi
fi
IGNOREPROP=wrapper.ignore_signals=TRUE
fi
-# Build the status file clause.
-if [ "X$DETAIL_STATUS" = "X" ]
-then
- STATUSPROP=
-else
- STATUSPROP="wrapper.statusfile=\"$STATUSFILE\" wrapper.java.statusfile=\"$JAVASTATUSFILE\""
-fi
-
# Build the lock file clause. Only create a lock file if the lock directory exists on this platform.
LOCKPROP=
if [ -d $LOCKDIR ]
then
if [ "X$1" != "X" ]
then
- # Resolve the primary group
+ # Resolve the primary group
RUN_AS_GROUP=`groups $RUN_AS_USER | awk '{print $3}' | tail -1`
if [ "X$RUN_AS_GROUP" = "X" ]
then
# Still want to change users, recurse. This means that the user will only be
# prompted for a password once. Variables shifted by 1
- #
- # Use "runuser" if this exists. runuser should be used on RedHat in preference to su.
- #
- if test -f "/sbin/runuser"
- then
- /sbin/runuser - $RUN_AS_USER -c "\"$REALPATH\" $2"
- else
- su - $RUN_AS_USER -c "\"$REALPATH\" $2"
- fi
+ su -m $RUN_AS_USER -c "\"$REALPATH\" $2"
# Now that we are the original user again, we may need to clean up the lock file.
if [ "X$LOCKPROP" != "X" ]
}
getpid() {
- pid=""
if [ -f "$PIDFILE" ]
then
if [ -r "$PIDFILE" ]
pidtest=`$PSEXE -p $pid -o args | grep "$WRAPPER_CMD" | tail -1`
;;
esac
-
if [ "X$pidtest" = "X" ]
then
# This is a stale pid file.
fi
}
-getstatus() {
- STATUS=
- if [ -f "$STATUSFILE" ]
- then
- if [ -r "$STATUSFILE" ]
- then
- STATUS=`cat "$STATUSFILE"`
- fi
- fi
- if [ "X$STATUS" = "X" ]
- then
- STATUS="Unknown"
- fi
-
- JAVASTATUS=
- if [ -f "$JAVASTATUSFILE" ]
- then
- if [ -r "$JAVASTATUSFILE" ]
- then
- JAVASTATUS=`cat "$JAVASTATUSFILE"`
- fi
- fi
- if [ "X$JAVASTATUS" = "X" ]
- then
- JAVASTATUS="Unknown"
- fi
-}
-
testpid() {
pid=`$PSEXE -p $pid | grep $pid | grep -v grep | awk '{print $1}' | tail -1`
if [ "X$pid" = "X" ]
if [ "X$pid" = "X" ]
then
# The string passed to eval must handles spaces in paths correctly.
- COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=\"$APP_NAME\" wrapper.pidfile=\"$PIDFILE\" wrapper.name=\"$APP_NAME\" wrapper.displayname=\"$APP_LONG_NAME\" $ANCHORPROP $STATUSPROP $LOCKPROP"
+ COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=$APP_NAME wrapper.pidfile=\"$PIDFILE\" $ANCHORPROP $LOCKPROP"
eval $COMMAND_LINE
else
echo "$APP_LONG_NAME is already running."
exit 1
fi
}
-
+
start() {
- echo -n "Starting $APP_LONG_NAME..."
+ echo "Starting $APP_LONG_NAME..."
getpid
if [ "X$pid" = "X" ]
then
# The string passed to eval must handles spaces in paths correctly.
- COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=\"$APP_NAME\" wrapper.pidfile=\"$PIDFILE\" wrapper.name=\"$APP_NAME\" wrapper.displayname=\"$APP_LONG_NAME\" wrapper.daemonize=TRUE $ANCHORPROP $IGNOREPROP $STATUSPROP $LOCKPROP"
+ COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=$APP_NAME wrapper.pidfile=\"$PIDFILE\" wrapper.daemonize=TRUE $ANCHORPROP $IGNOREPROP $LOCKPROP"
eval $COMMAND_LINE
else
echo "$APP_LONG_NAME is already running."
exit 1
fi
-
- # Sleep for a few seconds to allow for intialization if required
- # then test to make sure we're still running.
- #
- i=0
- while [ $i -lt $WAIT_AFTER_STARTUP ]
- do
- sleep 1
- echo -n "."
- i=`expr $i + 1`
- done
- if [ $WAIT_AFTER_STARTUP -gt 0 ]
+ getpid
+ if [ "X$pid" != "X" ]
then
- getpid
- if [ "X$pid" = "X" ]
- then
- echo " WARNING: $APP_LONG_NAME may have failed to start."
- exit 1
- else
- echo " running ($pid)."
- fi
+ echo "Started $APP_LONG_NAME."
else
- echo ""
- fi
+ echo "Failed to start $APP_LONG_NAME."
+ fi
}
-
+
stopit() {
echo "Stopping $APP_LONG_NAME..."
getpid
echo "$APP_LONG_NAME is not running."
exit 1
else
- if [ "X$DETAIL_STATUS" = "X" ]
- then
- echo "$APP_LONG_NAME is running (PID:$pid)."
- else
- getstatus
- echo "$APP_LONG_NAME is running (PID:$pid, Wrapper:$STATUS, Java:$JAVASTATUS)"
- fi
+ echo "$APP_LONG_NAME is running ($pid)."
exit 0
fi
}
if [ "X$pid" = "X" ]
then
echo "$APP_LONG_NAME was not running."
+
else
kill -3 $pid
fi
}
-# Used by HP-UX init scripts.
-startmsg() {
- getpid
- if [ "X$pid" = "X" ]
- then
- echo "Starting $APP_LONG_NAME... (Wrapper:Stopped)"
- else
- if [ "X$DETAIL_STATUS" = "X" ]
- then
- echo "Starting $APP_LONG_NAME... (Wrapper:Running)"
- else
- getstatus
- echo "Starting $APP_LONG_NAME... (Wrapper:$STATUS, Java:$JAVASTATUS)"
- fi
- fi
-}
-
-# Used by HP-UX init scripts.
-stopmsg() {
- getpid
- if [ "X$pid" = "X" ]
- then
- echo "Stopping $APP_LONG_NAME... (Wrapper:Stopped)"
- else
- if [ "X$DETAIL_STATUS" = "X" ]
- then
- echo "Stopping $APP_LONG_NAME... (Wrapper:Running)"
- else
- getstatus
- echo "Stopping $APP_LONG_NAME... (Wrapper:$STATUS, Java:$JAVASTATUS)"
- fi
- fi
-}
-
case "$1" in
'console')
dump
;;
- 'start_msg')
- checkUser "" $1
- startmsg
- ;;
-
- 'stop_msg')
- checkUser "" $1
- stopmsg
- ;;
-
*)
echo "Usage: $0 { console | start | stop | restart | status | dump }"
exit 1
#! /bin/sh
#
-# Copyright (c) 1999, 2008 Tanuki Software, Inc.
-# http://www.tanukisoftware.com
-# All rights reserved.
-#
-# This software is the confidential and proprietary information
-# of Tanuki Software. ("Confidential Information"). You shall
-# not disclose such Confidential Information and shall use it
-# only in accordance with the terms of the license agreement you
-# entered into with Tanuki Software.
+# Copyright (c) 1999, 2006 Tanuki Software Inc.
#
# Java Service Wrapper sh script. Suitable for starting and stopping
# wrapped Java applications on UNIX platforms.
#-----------------------------------------------------------------------------
# These settings can be modified to fit the needs of your application
-# Optimized for use with version 3.3.0 of the Wrapper.
+
+# Default values for the Application variables, below.
+#
+# NOTE: The build for specific applications may override this during the resource-copying
+# phase, to fill in a concrete name and avoid the use of the defaults specified here.
+DEF_APP_NAME="sonar"
+DEF_APP_LONG_NAME="sonar"
# Application
-APP_NAME="sonar"
-APP_LONG_NAME="sonar"
+APP_NAME="${DEF_APP_NAME}"
+APP_LONG_NAME="${DEF_APP_LONG_NAME}"
# Wrapper
WRAPPER_CMD="./wrapper"
# TERM signals.
#IGNORE_SIGNALS=true
-# Wrapper will start the JVM asynchronously. Your application may have some
-# initialization tasks and it may be desirable to wait a few seconds
-# before returning. For example, to delay the invocation of following
-# startup scripts. Setting WAIT_AFTER_STARTUP to a positive number will
-# cause the start command to delay for the indicated period of time
-# (in seconds).
-#
-WAIT_AFTER_STARTUP=0
-
-# If set, the status, start_msg and stop_msg commands will print out detailed
-# state information on the Wrapper and Java processes.
-#DETAIL_STATUS=true
-
# If specified, the Wrapper will be run as the specified user.
# IMPORTANT - Make sure that the user has the required privileges to write
# the PID file and wrapper.log files. Failure to be able to write the log
# The following two lines are used by the chkconfig command. Change as is
# appropriate for your application. They should remain commented.
# chkconfig: 2345 20 80
-# description: "Sonar Server"
-
-# Initialization block for the install_initd and remove_initd scripts used by
-# SUSE linux distributions.
-### BEGIN INIT INFO
-# Provides: @app.name@
-# Required-Start: $local_fs $network $syslog
-# Should-Start:
-# Required-Stop:
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Short-Description: @app.long.name@
-# Description: @app.description@
-### END INIT INFO
+# description: Test Wrapper Sample Application
# Do not modify anything beyond this point
#-----------------------------------------------------------------------------
# Process ID
ANCHORFILE="$PIDDIR/$APP_NAME.anchor"
-STATUSFILE="$PIDDIR/$APP_NAME.status"
-JAVASTATUSFILE="$PIDDIR/$APP_NAME.java.status"
PIDFILE="$PIDDIR/$APP_NAME.pid"
LOCKDIR="/var/lock/subsys"
LOCKFILE="$LOCKDIR/$APP_NAME"
case "$DIST_OS" in
'sunos')
DIST_OS="solaris"
+ PSEXE="/usr/ucb/ps"
;;
'hp-ux' | 'hp-ux64')
- # HP-UX needs the XPG4 version of ps (for -o args)
DIST_OS="hpux"
- UNIX95=""
- export UNIX95
;;
'darwin')
DIST_OS="macosx"
esac
# Resolve the architecture
-if [ "$DIST_OS" = "macosx" ]
+DIST_ARCH=`uname -p | tr [:upper:] [:lower:] | tr -d [:blank:]`
+if [ "$DIST_ARCH" = "unknown" ]
then
- DIST_ARCH="universal"
-else
- DIST_ARCH=
- DIST_ARCH=`uname -p 2>/dev/null | tr [:upper:] [:lower:] | tr -d [:blank:]`
- if [ "X$DIST_ARCH" = "X" ]
- then
- DIST_ARCH="unknown"
- fi
- if [ "$DIST_ARCH" = "unknown" ]
- then
- DIST_ARCH=`uname -m 2>/dev/null | tr [:upper:] [:lower:] | tr -d [:blank:]`
- fi
- case "$DIST_ARCH" in
- 'amd64' | 'athlon' | 'i386' | 'i486' | 'i586' | 'i686' | 'x86_64')
- DIST_ARCH="x86"
- ;;
- 'ia32' | 'ia64' | 'ia64n' | 'ia64w')
- DIST_ARCH="ia"
- ;;
- 'ip27')
- DIST_ARCH="mips"
- ;;
- 'power' | 'powerpc' | 'power_pc' | 'ppc64')
- DIST_ARCH="ppc"
- ;;
- 'pa_risc' | 'pa-risc')
- DIST_ARCH="parisc"
- ;;
- 'sun4u' | 'sparcv9')
- DIST_ARCH="sparc"
- ;;
- '9000/800')
- DIST_ARCH="parisc"
- ;;
- esac
-fi
-
-# OSX always places Java in the same location so we can reliably set JAVA_HOME
-if [ "$DIST_OS" = "macosx" ]
-then
- if [ -z "$JAVA_HOME" ]; then
- JAVA_HOME="/Library/Java/Home"; export JAVA_HOME
- fi
+ DIST_ARCH=`uname -m | tr [:upper:] [:lower:] | tr -d [:blank:]`
fi
+case "$DIST_ARCH" in
+ 'amd64' | 'athlon' | 'ia32' | 'ia64' | 'i386' | 'i486' | 'i586' | 'i686' | 'x86_64')
+ DIST_ARCH="x86"
+ ;;
+ 'ip27')
+ DIST_ARCH="mips"
+ ;;
+ 'power' | 'powerpc' | 'power_pc' | 'ppc64')
+ DIST_ARCH="ppc"
+ ;;
+ 'pa_risc' | 'pa-risc')
+ DIST_ARCH="parisc"
+ ;;
+ 'sun4u' | 'sparcv9')
+ DIST_ARCH="sparc"
+ ;;
+ '9000/800')
+ DIST_ARCH="parisc"
+ ;;
+esac
outputFile() {
if [ -f "$1" ]
# If a 32-bit wrapper binary exists then it will work on 32 or 64 bit
# platforms, if the 64-bit binary exists then the distribution most
# likely wants to use long names. Otherwise, look for the default.
+# For macosx, we also want to look for universal binaries.
WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32"
if [ -x "$WRAPPER_TEST_CMD" ]
then
WRAPPER_CMD="$WRAPPER_TEST_CMD"
else
- WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
- if [ -x "$WRAPPER_TEST_CMD" ]
+ if [ "$DIST_OS" = "macosx" ]
then
- WRAPPER_CMD="$WRAPPER_TEST_CMD"
+ WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-universal-32"
+ if [ -x "$WRAPPER_TEST_CMD" ]
+ then
+ WRAPPER_CMD="$WRAPPER_TEST_CMD"
+ else
+ WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
+ if [ -x "$WRAPPER_TEST_CMD" ]
+ then
+ WRAPPER_CMD="$WRAPPER_TEST_CMD"
+ else
+ WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-universal-64"
+ if [ -x "$WRAPPER_TEST_CMD" ]
+ then
+ WRAPPER_CMD="$WRAPPER_TEST_CMD"
+ else
+ if [ ! -x "$WRAPPER_CMD" ]
+ then
+ echo "Unable to locate any of the following binaries:"
+ outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32"
+ outputFile "$WRAPPER_CMD-$DIST_OS-universal-32"
+ outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
+ outputFile "$WRAPPER_CMD-$DIST_OS-universal-64"
+ outputFile "$WRAPPER_CMD"
+ exit 1
+ fi
+ fi
+ fi
+ fi
else
- if [ ! -x "$WRAPPER_CMD" ]
+ WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
+ if [ -x "$WRAPPER_TEST_CMD" ]
then
- echo "Unable to locate any of the following binaries:"
- outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32"
- outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
- outputFile "$WRAPPER_CMD"
- exit 1
+ WRAPPER_CMD="$WRAPPER_TEST_CMD"
+ else
+ if [ ! -x "$WRAPPER_CMD" ]
+ then
+ echo "Unable to locate any of the following binaries:"
+ outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32"
+ outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
+ outputFile "$WRAPPER_CMD"
+ exit 1
+ fi
fi
fi
fi
IGNOREPROP=wrapper.ignore_signals=TRUE
fi
-# Build the status file clause.
-if [ "X$DETAIL_STATUS" = "X" ]
-then
- STATUSPROP=
-else
- STATUSPROP="wrapper.statusfile=\"$STATUSFILE\" wrapper.java.statusfile=\"$JAVASTATUSFILE\""
-fi
-
# Build the lock file clause. Only create a lock file if the lock directory exists on this platform.
LOCKPROP=
if [ -d $LOCKDIR ]
then
if [ "X$1" != "X" ]
then
- # Resolve the primary group
+ # Resolve the primary group
RUN_AS_GROUP=`groups $RUN_AS_USER | awk '{print $3}' | tail -1`
if [ "X$RUN_AS_GROUP" = "X" ]
then
# Still want to change users, recurse. This means that the user will only be
# prompted for a password once. Variables shifted by 1
- #
- # Use "runuser" if this exists. runuser should be used on RedHat in preference to su.
- #
- if test -f "/sbin/runuser"
- then
- /sbin/runuser - $RUN_AS_USER -c "\"$REALPATH\" $2"
- else
- su - $RUN_AS_USER -c "\"$REALPATH\" $2"
- fi
+ su -m $RUN_AS_USER -c "\"$REALPATH\" $2"
# Now that we are the original user again, we may need to clean up the lock file.
if [ "X$LOCKPROP" != "X" ]
}
getpid() {
- pid=""
if [ -f "$PIDFILE" ]
then
if [ -r "$PIDFILE" ]
# common is during system startup after an unclean shutdown.
# The ps statement below looks for the specific wrapper command running as
# the pid. If it is not found then the pid file is considered to be stale.
- case "$DIST_OS" in
- 'macosx')
- pidtest=`$PSEXE -ww -p $pid -o command | grep "$WRAPPER_CMD" | tail -1`
- ;;
- *)
- pidtest=`$PSEXE -p $pid -o args | grep "$WRAPPER_CMD" | tail -1`
- ;;
- esac
-
+ if [ "$DIST_OS" = "solaris" ]
+ then
+ pidtest=`$PSEXE ww $pid | grep "$WRAPPER_CMD" | tail -1`
+ else
+ pidtest=`$PSEXE -p $pid -o args | grep "$WRAPPER_CMD" | tail -1`
+ fi
if [ "X$pidtest" = "X" ]
then
# This is a stale pid file.
fi
}
-getstatus() {
- STATUS=
- if [ -f "$STATUSFILE" ]
- then
- if [ -r "$STATUSFILE" ]
- then
- STATUS=`cat "$STATUSFILE"`
- fi
- fi
- if [ "X$STATUS" = "X" ]
- then
- STATUS="Unknown"
- fi
-
- JAVASTATUS=
- if [ -f "$JAVASTATUSFILE" ]
- then
- if [ -r "$JAVASTATUSFILE" ]
- then
- JAVASTATUS=`cat "$JAVASTATUSFILE"`
- fi
- fi
- if [ "X$JAVASTATUS" = "X" ]
+testpid() {
+ if [ "$DIST_OS" = "solaris" ]
then
- JAVASTATUS="Unknown"
+ pid=`$PSEXE ww $pid | grep $pid | grep -v grep | awk '{print $1}' | tail -1`
+ else
+ pid=`$PSEXE -p $pid | grep $pid | grep -v grep | awk '{print $1}' | tail -1`
fi
-}
-
-testpid() {
- pid=`$PSEXE -p $pid | grep $pid | grep -v grep | awk '{print $1}' | tail -1`
if [ "X$pid" = "X" ]
then
# Process is gone so remove the pid file.
if [ "X$pid" = "X" ]
then
# The string passed to eval must handles spaces in paths correctly.
- COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=\"$APP_NAME\" wrapper.pidfile=\"$PIDFILE\" wrapper.name=\"$APP_NAME\" wrapper.displayname=\"$APP_LONG_NAME\" $ANCHORPROP $STATUSPROP $LOCKPROP"
+ COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=$APP_NAME wrapper.pidfile=\"$PIDFILE\" $ANCHORPROP $LOCKPROP"
eval $COMMAND_LINE
else
echo "$APP_LONG_NAME is already running."
exit 1
fi
}
-
+
start() {
- echo -n "Starting $APP_LONG_NAME..."
+ echo "Starting $APP_LONG_NAME..."
getpid
if [ "X$pid" = "X" ]
then
# The string passed to eval must handles spaces in paths correctly.
- COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=\"$APP_NAME\" wrapper.pidfile=\"$PIDFILE\" wrapper.name=\"$APP_NAME\" wrapper.displayname=\"$APP_LONG_NAME\" wrapper.daemonize=TRUE $ANCHORPROP $IGNOREPROP $STATUSPROP $LOCKPROP"
+ COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=$APP_NAME wrapper.pidfile=\"$PIDFILE\" wrapper.daemonize=TRUE $ANCHORPROP $IGNOREPROP $LOCKPROP"
eval $COMMAND_LINE
else
echo "$APP_LONG_NAME is already running."
exit 1
fi
-
- # Sleep for a few seconds to allow for intialization if required
- # then test to make sure we're still running.
- #
- i=0
- while [ $i -lt $WAIT_AFTER_STARTUP ]
- do
- sleep 1
- echo -n "."
- i=`expr $i + 1`
- done
- if [ $WAIT_AFTER_STARTUP -gt 0 ]
+ getpid
+ if [ "X$pid" != "X" ]
then
- getpid
- if [ "X$pid" = "X" ]
- then
- echo " WARNING: $APP_LONG_NAME may have failed to start."
- exit 1
- else
- echo " running ($pid)."
- fi
+ echo "Started $APP_LONG_NAME."
else
- echo ""
- fi
+ echo "Failed to start $APP_LONG_NAME."
+ fi
}
-
+
stopit() {
echo "Stopping $APP_LONG_NAME..."
getpid
echo "$APP_LONG_NAME is not running."
exit 1
else
- if [ "X$DETAIL_STATUS" = "X" ]
- then
- echo "$APP_LONG_NAME is running (PID:$pid)."
- else
- getstatus
- echo "$APP_LONG_NAME is running (PID:$pid, Wrapper:$STATUS, Java:$JAVASTATUS)"
- fi
+ echo "$APP_LONG_NAME is running ($pid)."
exit 0
fi
}
if [ "X$pid" = "X" ]
then
echo "$APP_LONG_NAME was not running."
+
else
kill -3 $pid
fi
}
-# Used by HP-UX init scripts.
-startmsg() {
- getpid
- if [ "X$pid" = "X" ]
- then
- echo "Starting $APP_LONG_NAME... (Wrapper:Stopped)"
- else
- if [ "X$DETAIL_STATUS" = "X" ]
- then
- echo "Starting $APP_LONG_NAME... (Wrapper:Running)"
- else
- getstatus
- echo "Starting $APP_LONG_NAME... (Wrapper:$STATUS, Java:$JAVASTATUS)"
- fi
- fi
-}
-
-# Used by HP-UX init scripts.
-stopmsg() {
- getpid
- if [ "X$pid" = "X" ]
- then
- echo "Stopping $APP_LONG_NAME... (Wrapper:Stopped)"
- else
- if [ "X$DETAIL_STATUS" = "X" ]
- then
- echo "Stopping $APP_LONG_NAME... (Wrapper:Running)"
- else
- getstatus
- echo "Stopping $APP_LONG_NAME... (Wrapper:$STATUS, Java:$JAVASTATUS)"
- fi
- fi
-}
-
case "$1" in
'console')
dump
;;
- 'start_msg')
- checkUser "" $1
- startmsg
- ;;
-
- 'stop_msg')
- checkUser "" $1
- stopmsg
- ;;
-
*)
echo "Usage: $0 { console | start | stop | restart | status | dump }"
exit 1
#! /bin/sh
#
-# Copyright (c) 1999, 2008 Tanuki Software, Inc.
-# http://www.tanukisoftware.com
-# All rights reserved.
-#
-# This software is the confidential and proprietary information
-# of Tanuki Software. ("Confidential Information"). You shall
-# not disclose such Confidential Information and shall use it
-# only in accordance with the terms of the license agreement you
-# entered into with Tanuki Software.
+# Copyright (c) 1999, 2006 Tanuki Software Inc.
#
# Java Service Wrapper sh script. Suitable for starting and stopping
# wrapped Java applications on UNIX platforms.
#-----------------------------------------------------------------------------
# These settings can be modified to fit the needs of your application
-# Optimized for use with version 3.3.0 of the Wrapper.
+
+# Default values for the Application variables, below.
+#
+# NOTE: The build for specific applications may override this during the resource-copying
+# phase, to fill in a concrete name and avoid the use of the defaults specified here.
+DEF_APP_NAME="sonar"
+DEF_APP_LONG_NAME="sonar"
# Application
-APP_NAME="sonar"
-APP_LONG_NAME="sonar"
+APP_NAME="${DEF_APP_NAME}"
+APP_LONG_NAME="${DEF_APP_LONG_NAME}"
# Wrapper
WRAPPER_CMD="./wrapper"
# TERM signals.
#IGNORE_SIGNALS=true
-# Wrapper will start the JVM asynchronously. Your application may have some
-# initialization tasks and it may be desirable to wait a few seconds
-# before returning. For example, to delay the invocation of following
-# startup scripts. Setting WAIT_AFTER_STARTUP to a positive number will
-# cause the start command to delay for the indicated period of time
-# (in seconds).
-#
-WAIT_AFTER_STARTUP=0
-
-# If set, the status, start_msg and stop_msg commands will print out detailed
-# state information on the Wrapper and Java processes.
-#DETAIL_STATUS=true
-
# If specified, the Wrapper will be run as the specified user.
# IMPORTANT - Make sure that the user has the required privileges to write
# the PID file and wrapper.log files. Failure to be able to write the log
# The following two lines are used by the chkconfig command. Change as is
# appropriate for your application. They should remain commented.
# chkconfig: 2345 20 80
-# description: "Sonar Server"
-
-# Initialization block for the install_initd and remove_initd scripts used by
-# SUSE linux distributions.
-### BEGIN INIT INFO
-# Provides: @app.name@
-# Required-Start: $local_fs $network $syslog
-# Should-Start:
-# Required-Stop:
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Short-Description: @app.long.name@
-# Description: @app.description@
-### END INIT INFO
+# description: Test Wrapper Sample Application
# Do not modify anything beyond this point
#-----------------------------------------------------------------------------
# Process ID
ANCHORFILE="$PIDDIR/$APP_NAME.anchor"
-STATUSFILE="$PIDDIR/$APP_NAME.status"
-JAVASTATUSFILE="$PIDDIR/$APP_NAME.java.status"
PIDFILE="$PIDDIR/$APP_NAME.pid"
LOCKDIR="/var/lock/subsys"
LOCKFILE="$LOCKDIR/$APP_NAME"
case "$DIST_OS" in
'sunos')
DIST_OS="solaris"
+ PSEXE="/usr/ucb/ps"
;;
'hp-ux' | 'hp-ux64')
- # HP-UX needs the XPG4 version of ps (for -o args)
DIST_OS="hpux"
- UNIX95=""
- export UNIX95
;;
'darwin')
DIST_OS="macosx"
esac
# Resolve the architecture
-if [ "$DIST_OS" = "macosx" ]
+DIST_ARCH=`uname -p | tr [:upper:] [:lower:] | tr -d [:blank:]`
+if [ "$DIST_ARCH" = "unknown" ]
then
- DIST_ARCH="universal"
-else
- DIST_ARCH=
- DIST_ARCH=`uname -p 2>/dev/null | tr [:upper:] [:lower:] | tr -d [:blank:]`
- if [ "X$DIST_ARCH" = "X" ]
- then
- DIST_ARCH="unknown"
- fi
- if [ "$DIST_ARCH" = "unknown" ]
- then
- DIST_ARCH=`uname -m 2>/dev/null | tr [:upper:] [:lower:] | tr -d [:blank:]`
- fi
- case "$DIST_ARCH" in
- 'amd64' | 'athlon' | 'i386' | 'i486' | 'i586' | 'i686' | 'x86_64')
- DIST_ARCH="x86"
- ;;
- 'ia32' | 'ia64' | 'ia64n' | 'ia64w')
- DIST_ARCH="ia"
- ;;
- 'ip27')
- DIST_ARCH="mips"
- ;;
- 'power' | 'powerpc' | 'power_pc' | 'ppc64')
- DIST_ARCH="ppc"
- ;;
- 'pa_risc' | 'pa-risc')
- DIST_ARCH="parisc"
- ;;
- 'sun4u' | 'sparcv9')
- DIST_ARCH="sparc"
- ;;
- '9000/800')
- DIST_ARCH="parisc"
- ;;
- esac
-fi
-
-# OSX always places Java in the same location so we can reliably set JAVA_HOME
-if [ "$DIST_OS" = "macosx" ]
-then
- if [ -z "$JAVA_HOME" ]; then
- JAVA_HOME="/Library/Java/Home"; export JAVA_HOME
- fi
+ DIST_ARCH=`uname -m | tr [:upper:] [:lower:] | tr -d [:blank:]`
fi
+case "$DIST_ARCH" in
+ 'amd64' | 'athlon' | 'ia32' | 'ia64' | 'i386' | 'i486' | 'i586' | 'i686' | 'x86_64')
+ DIST_ARCH="x86"
+ ;;
+ 'ip27')
+ DIST_ARCH="mips"
+ ;;
+ 'power' | 'powerpc' | 'power_pc' | 'ppc64')
+ DIST_ARCH="ppc"
+ ;;
+ 'pa_risc' | 'pa-risc')
+ DIST_ARCH="parisc"
+ ;;
+ 'sun4u' | 'sparcv9')
+ DIST_ARCH="sparc"
+ ;;
+ '9000/800')
+ DIST_ARCH="parisc"
+ ;;
+esac
outputFile() {
if [ -f "$1" ]
# If a 32-bit wrapper binary exists then it will work on 32 or 64 bit
# platforms, if the 64-bit binary exists then the distribution most
# likely wants to use long names. Otherwise, look for the default.
+# For macosx, we also want to look for universal binaries.
WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32"
if [ -x "$WRAPPER_TEST_CMD" ]
then
WRAPPER_CMD="$WRAPPER_TEST_CMD"
else
- WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
- if [ -x "$WRAPPER_TEST_CMD" ]
+ if [ "$DIST_OS" = "macosx" ]
then
- WRAPPER_CMD="$WRAPPER_TEST_CMD"
+ WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-universal-32"
+ if [ -x "$WRAPPER_TEST_CMD" ]
+ then
+ WRAPPER_CMD="$WRAPPER_TEST_CMD"
+ else
+ WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
+ if [ -x "$WRAPPER_TEST_CMD" ]
+ then
+ WRAPPER_CMD="$WRAPPER_TEST_CMD"
+ else
+ WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-universal-64"
+ if [ -x "$WRAPPER_TEST_CMD" ]
+ then
+ WRAPPER_CMD="$WRAPPER_TEST_CMD"
+ else
+ if [ ! -x "$WRAPPER_CMD" ]
+ then
+ echo "Unable to locate any of the following binaries:"
+ outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32"
+ outputFile "$WRAPPER_CMD-$DIST_OS-universal-32"
+ outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
+ outputFile "$WRAPPER_CMD-$DIST_OS-universal-64"
+ outputFile "$WRAPPER_CMD"
+ exit 1
+ fi
+ fi
+ fi
+ fi
else
- if [ ! -x "$WRAPPER_CMD" ]
+ WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
+ if [ -x "$WRAPPER_TEST_CMD" ]
then
- echo "Unable to locate any of the following binaries:"
- outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32"
- outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
- outputFile "$WRAPPER_CMD"
- exit 1
+ WRAPPER_CMD="$WRAPPER_TEST_CMD"
+ else
+ if [ ! -x "$WRAPPER_CMD" ]
+ then
+ echo "Unable to locate any of the following binaries:"
+ outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32"
+ outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
+ outputFile "$WRAPPER_CMD"
+ exit 1
+ fi
fi
fi
fi
IGNOREPROP=wrapper.ignore_signals=TRUE
fi
-# Build the status file clause.
-if [ "X$DETAIL_STATUS" = "X" ]
-then
- STATUSPROP=
-else
- STATUSPROP="wrapper.statusfile=\"$STATUSFILE\" wrapper.java.statusfile=\"$JAVASTATUSFILE\""
-fi
-
# Build the lock file clause. Only create a lock file if the lock directory exists on this platform.
LOCKPROP=
if [ -d $LOCKDIR ]
then
if [ "X$1" != "X" ]
then
- # Resolve the primary group
+ # Resolve the primary group
RUN_AS_GROUP=`groups $RUN_AS_USER | awk '{print $3}' | tail -1`
if [ "X$RUN_AS_GROUP" = "X" ]
then
# Still want to change users, recurse. This means that the user will only be
# prompted for a password once. Variables shifted by 1
- #
- # Use "runuser" if this exists. runuser should be used on RedHat in preference to su.
- #
- if test -f "/sbin/runuser"
- then
- /sbin/runuser - $RUN_AS_USER -c "\"$REALPATH\" $2"
- else
- su - $RUN_AS_USER -c "\"$REALPATH\" $2"
- fi
+ su -m $RUN_AS_USER -c "\"$REALPATH\" $2"
# Now that we are the original user again, we may need to clean up the lock file.
if [ "X$LOCKPROP" != "X" ]
}
getpid() {
- pid=""
if [ -f "$PIDFILE" ]
then
if [ -r "$PIDFILE" ]
# common is during system startup after an unclean shutdown.
# The ps statement below looks for the specific wrapper command running as
# the pid. If it is not found then the pid file is considered to be stale.
- case "$DIST_OS" in
- 'macosx')
- pidtest=`$PSEXE -ww -p $pid -o command | grep "$WRAPPER_CMD" | tail -1`
- ;;
- *)
- pidtest=`$PSEXE -p $pid -o args | grep "$WRAPPER_CMD" | tail -1`
- ;;
- esac
-
+ if [ "$DIST_OS" = "solaris" ]
+ then
+ pidtest=`$PSEXE ww $pid | grep "$WRAPPER_CMD" | tail -1`
+ else
+ pidtest=`$PSEXE -p $pid -o args | grep "$WRAPPER_CMD" | tail -1`
+ fi
if [ "X$pidtest" = "X" ]
then
# This is a stale pid file.
fi
}
-getstatus() {
- STATUS=
- if [ -f "$STATUSFILE" ]
- then
- if [ -r "$STATUSFILE" ]
- then
- STATUS=`cat "$STATUSFILE"`
- fi
- fi
- if [ "X$STATUS" = "X" ]
- then
- STATUS="Unknown"
- fi
-
- JAVASTATUS=
- if [ -f "$JAVASTATUSFILE" ]
- then
- if [ -r "$JAVASTATUSFILE" ]
- then
- JAVASTATUS=`cat "$JAVASTATUSFILE"`
- fi
- fi
- if [ "X$JAVASTATUS" = "X" ]
+testpid() {
+ if [ "$DIST_OS" = "solaris" ]
then
- JAVASTATUS="Unknown"
+ pid=`$PSEXE ww $pid | grep $pid | grep -v grep | awk '{print $1}' | tail -1`
+ else
+ pid=`$PSEXE -p $pid | grep $pid | grep -v grep | awk '{print $1}' | tail -1`
fi
-}
-
-testpid() {
- pid=`$PSEXE -p $pid | grep $pid | grep -v grep | awk '{print $1}' | tail -1`
if [ "X$pid" = "X" ]
then
# Process is gone so remove the pid file.
if [ "X$pid" = "X" ]
then
# The string passed to eval must handles spaces in paths correctly.
- COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=\"$APP_NAME\" wrapper.pidfile=\"$PIDFILE\" wrapper.name=\"$APP_NAME\" wrapper.displayname=\"$APP_LONG_NAME\" $ANCHORPROP $STATUSPROP $LOCKPROP"
+ COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=$APP_NAME wrapper.pidfile=\"$PIDFILE\" $ANCHORPROP $LOCKPROP"
eval $COMMAND_LINE
else
echo "$APP_LONG_NAME is already running."
exit 1
fi
}
-
+
start() {
- echo -n "Starting $APP_LONG_NAME..."
+ echo "Starting $APP_LONG_NAME..."
getpid
if [ "X$pid" = "X" ]
then
# The string passed to eval must handles spaces in paths correctly.
- COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=\"$APP_NAME\" wrapper.pidfile=\"$PIDFILE\" wrapper.name=\"$APP_NAME\" wrapper.displayname=\"$APP_LONG_NAME\" wrapper.daemonize=TRUE $ANCHORPROP $IGNOREPROP $STATUSPROP $LOCKPROP"
+ COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=$APP_NAME wrapper.pidfile=\"$PIDFILE\" wrapper.daemonize=TRUE $ANCHORPROP $IGNOREPROP $LOCKPROP"
eval $COMMAND_LINE
else
echo "$APP_LONG_NAME is already running."
exit 1
fi
-
- # Sleep for a few seconds to allow for intialization if required
- # then test to make sure we're still running.
- #
- i=0
- while [ $i -lt $WAIT_AFTER_STARTUP ]
- do
- sleep 1
- echo -n "."
- i=`expr $i + 1`
- done
- if [ $WAIT_AFTER_STARTUP -gt 0 ]
+ getpid
+ if [ "X$pid" != "X" ]
then
- getpid
- if [ "X$pid" = "X" ]
- then
- echo " WARNING: $APP_LONG_NAME may have failed to start."
- exit 1
- else
- echo " running ($pid)."
- fi
+ echo "Started $APP_LONG_NAME."
else
- echo ""
- fi
+ echo "Failed to start $APP_LONG_NAME."
+ fi
}
-
+
stopit() {
echo "Stopping $APP_LONG_NAME..."
getpid
echo "$APP_LONG_NAME is not running."
exit 1
else
- if [ "X$DETAIL_STATUS" = "X" ]
- then
- echo "$APP_LONG_NAME is running (PID:$pid)."
- else
- getstatus
- echo "$APP_LONG_NAME is running (PID:$pid, Wrapper:$STATUS, Java:$JAVASTATUS)"
- fi
+ echo "$APP_LONG_NAME is running ($pid)."
exit 0
fi
}
if [ "X$pid" = "X" ]
then
echo "$APP_LONG_NAME was not running."
+
else
kill -3 $pid
fi
}
-# Used by HP-UX init scripts.
-startmsg() {
- getpid
- if [ "X$pid" = "X" ]
- then
- echo "Starting $APP_LONG_NAME... (Wrapper:Stopped)"
- else
- if [ "X$DETAIL_STATUS" = "X" ]
- then
- echo "Starting $APP_LONG_NAME... (Wrapper:Running)"
- else
- getstatus
- echo "Starting $APP_LONG_NAME... (Wrapper:$STATUS, Java:$JAVASTATUS)"
- fi
- fi
-}
-
-# Used by HP-UX init scripts.
-stopmsg() {
- getpid
- if [ "X$pid" = "X" ]
- then
- echo "Stopping $APP_LONG_NAME... (Wrapper:Stopped)"
- else
- if [ "X$DETAIL_STATUS" = "X" ]
- then
- echo "Stopping $APP_LONG_NAME... (Wrapper:Running)"
- else
- getstatus
- echo "Stopping $APP_LONG_NAME... (Wrapper:$STATUS, Java:$JAVASTATUS)"
- fi
- fi
-}
-
case "$1" in
'console')
dump
;;
- 'start_msg')
- checkUser "" $1
- startmsg
- ;;
-
- 'stop_msg')
- checkUser "" $1
- stopmsg
- ;;
-
*)
echo "Usage: $0 { console | start | stop | restart | status | dump }"
exit 1
#! /bin/sh
#
-# Copyright (c) 1999, 2008 Tanuki Software, Inc.
-# http://www.tanukisoftware.com
-# All rights reserved.
-#
-# This software is the confidential and proprietary information
-# of Tanuki Software. ("Confidential Information"). You shall
-# not disclose such Confidential Information and shall use it
-# only in accordance with the terms of the license agreement you
-# entered into with Tanuki Software.
+# Copyright (c) 1999, 2006 Tanuki Software Inc.
#
# Java Service Wrapper sh script. Suitable for starting and stopping
# wrapped Java applications on UNIX platforms.
#-----------------------------------------------------------------------------
# These settings can be modified to fit the needs of your application
-# Optimized for use with version 3.3.0 of the Wrapper.
+
+# Default values for the Application variables, below.
+#
+# NOTE: The build for specific applications may override this during the resource-copying
+# phase, to fill in a concrete name and avoid the use of the defaults specified here.
+DEF_APP_NAME="sonar"
+DEF_APP_LONG_NAME="sonar"
# Application
-APP_NAME="sonar"
-APP_LONG_NAME="sonar"
+APP_NAME="${DEF_APP_NAME}"
+APP_LONG_NAME="${DEF_APP_LONG_NAME}"
# Wrapper
WRAPPER_CMD="./wrapper"
# TERM signals.
#IGNORE_SIGNALS=true
-# Wrapper will start the JVM asynchronously. Your application may have some
-# initialization tasks and it may be desirable to wait a few seconds
-# before returning. For example, to delay the invocation of following
-# startup scripts. Setting WAIT_AFTER_STARTUP to a positive number will
-# cause the start command to delay for the indicated period of time
-# (in seconds).
-#
-WAIT_AFTER_STARTUP=0
-
-# If set, the status, start_msg and stop_msg commands will print out detailed
-# state information on the Wrapper and Java processes.
-#DETAIL_STATUS=true
-
# If specified, the Wrapper will be run as the specified user.
# IMPORTANT - Make sure that the user has the required privileges to write
# the PID file and wrapper.log files. Failure to be able to write the log
# NOTE - This will set the user which is used to run the Wrapper as well as
# the JVM and is not useful in situations where a privileged resource or
# port needs to be allocated prior to the user being changed.
-#RUN_AS_USER=
+#RUN_AS_USER=nexus
# The following two lines are used by the chkconfig command. Change as is
# appropriate for your application. They should remain commented.
# chkconfig: 2345 20 80
-# description: "Sonar Server"
-
-# Initialization block for the install_initd and remove_initd scripts used by
-# SUSE linux distributions.
-### BEGIN INIT INFO
-# Provides: @app.name@
-# Required-Start: $local_fs $network $syslog
-# Should-Start:
-# Required-Stop:
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Short-Description: @app.long.name@
-# Description: @app.description@
-### END INIT INFO
+# description: Test Wrapper Sample Application
# Do not modify anything beyond this point
#-----------------------------------------------------------------------------
# Process ID
ANCHORFILE="$PIDDIR/$APP_NAME.anchor"
-STATUSFILE="$PIDDIR/$APP_NAME.status"
-JAVASTATUSFILE="$PIDDIR/$APP_NAME.java.status"
PIDFILE="$PIDDIR/$APP_NAME.pid"
LOCKDIR="/var/lock/subsys"
LOCKFILE="$LOCKDIR/$APP_NAME"
DIST_OS="solaris"
;;
'hp-ux' | 'hp-ux64')
- # HP-UX needs the XPG4 version of ps (for -o args)
DIST_OS="hpux"
- UNIX95=""
- export UNIX95
;;
'darwin')
DIST_OS="macosx"
esac
# Resolve the architecture
-if [ "$DIST_OS" = "macosx" ]
-then
- DIST_ARCH="universal"
-else
- DIST_ARCH=
- DIST_ARCH=`uname -p 2>/dev/null | tr [:upper:] [:lower:] | tr -d [:blank:]`
- if [ "X$DIST_ARCH" = "X" ]
- then
- DIST_ARCH="unknown"
- fi
- if [ "$DIST_ARCH" = "unknown" ]
- then
- DIST_ARCH=`uname -m 2>/dev/null | tr [:upper:] [:lower:] | tr -d [:blank:]`
- fi
- case "$DIST_ARCH" in
- 'amd64' | 'athlon' | 'i386' | 'i486' | 'i586' | 'i686' | 'x86_64')
- DIST_ARCH="x86"
- ;;
- 'ia32' | 'ia64' | 'ia64n' | 'ia64w')
- DIST_ARCH="ia"
- ;;
- 'ip27')
- DIST_ARCH="mips"
- ;;
- 'power' | 'powerpc' | 'power_pc' | 'ppc64')
- DIST_ARCH="ppc"
- ;;
- 'pa_risc' | 'pa-risc')
- DIST_ARCH="parisc"
- ;;
- 'sun4u' | 'sparcv9')
- DIST_ARCH="sparc"
- ;;
- '9000/800')
- DIST_ARCH="parisc"
- ;;
- esac
-fi
-
-# OSX always places Java in the same location so we can reliably set JAVA_HOME
-if [ "$DIST_OS" = "macosx" ]
+DIST_ARCH=`uname -p | tr [:upper:] [:lower:] | tr -d [:blank:]`
+if [ "$DIST_ARCH" = "unknown" ]
then
- if [ -z "$JAVA_HOME" ]; then
- JAVA_HOME="/Library/Java/Home"; export JAVA_HOME
- fi
+ DIST_ARCH=`uname -m | tr [:upper:] [:lower:] | tr -d [:blank:]`
fi
+case "$DIST_ARCH" in
+ 'amd64' | 'athlon' | 'ia32' | 'ia64' | 'i386' | 'i486' | 'i586' | 'i686' | 'x86_64')
+ DIST_ARCH="x86"
+ ;;
+ 'ip27')
+ DIST_ARCH="mips"
+ ;;
+ 'power' | 'powerpc' | 'power_pc' | 'ppc64')
+ DIST_ARCH="ppc"
+ ;;
+ 'pa_risc' | 'pa-risc')
+ DIST_ARCH="parisc"
+ ;;
+ 'sun4u' | 'sparcv9')
+ DIST_ARCH="sparc"
+ ;;
+ '9000/800')
+ DIST_ARCH="parisc"
+ ;;
+esac
outputFile() {
if [ -f "$1" ]
# If a 32-bit wrapper binary exists then it will work on 32 or 64 bit
# platforms, if the 64-bit binary exists then the distribution most
# likely wants to use long names. Otherwise, look for the default.
+# For macosx, we also want to look for universal binaries.
WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32"
if [ -x "$WRAPPER_TEST_CMD" ]
then
WRAPPER_CMD="$WRAPPER_TEST_CMD"
else
- WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
- if [ -x "$WRAPPER_TEST_CMD" ]
+ if [ "$DIST_OS" = "macosx" ]
then
- WRAPPER_CMD="$WRAPPER_TEST_CMD"
+ WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-universal-32"
+ if [ -x "$WRAPPER_TEST_CMD" ]
+ then
+ WRAPPER_CMD="$WRAPPER_TEST_CMD"
+ else
+ WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
+ if [ -x "$WRAPPER_TEST_CMD" ]
+ then
+ WRAPPER_CMD="$WRAPPER_TEST_CMD"
+ else
+ WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-universal-64"
+ if [ -x "$WRAPPER_TEST_CMD" ]
+ then
+ WRAPPER_CMD="$WRAPPER_TEST_CMD"
+ else
+ if [ ! -x "$WRAPPER_CMD" ]
+ then
+ echo "Unable to locate any of the following binaries:"
+ outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32"
+ outputFile "$WRAPPER_CMD-$DIST_OS-universal-32"
+ outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
+ outputFile "$WRAPPER_CMD-$DIST_OS-universal-64"
+ outputFile "$WRAPPER_CMD"
+ exit 1
+ fi
+ fi
+ fi
+ fi
else
- if [ ! -x "$WRAPPER_CMD" ]
+ WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
+ if [ -x "$WRAPPER_TEST_CMD" ]
then
- echo "Unable to locate any of the following binaries:"
- outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32"
- outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
- outputFile "$WRAPPER_CMD"
- exit 1
+ WRAPPER_CMD="$WRAPPER_TEST_CMD"
+ else
+ if [ ! -x "$WRAPPER_CMD" ]
+ then
+ echo "Unable to locate any of the following binaries:"
+ outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32"
+ outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
+ outputFile "$WRAPPER_CMD"
+ exit 1
+ fi
fi
fi
fi
IGNOREPROP=wrapper.ignore_signals=TRUE
fi
-# Build the status file clause.
-if [ "X$DETAIL_STATUS" = "X" ]
-then
- STATUSPROP=
-else
- STATUSPROP="wrapper.statusfile=\"$STATUSFILE\" wrapper.java.statusfile=\"$JAVASTATUSFILE\""
-fi
-
# Build the lock file clause. Only create a lock file if the lock directory exists on this platform.
LOCKPROP=
if [ -d $LOCKDIR ]
then
if [ "X$1" != "X" ]
then
- # Resolve the primary group
+ # Resolve the primary group
RUN_AS_GROUP=`groups $RUN_AS_USER | awk '{print $3}' | tail -1`
if [ "X$RUN_AS_GROUP" = "X" ]
then
# Still want to change users, recurse. This means that the user will only be
# prompted for a password once. Variables shifted by 1
- #
- # Use "runuser" if this exists. runuser should be used on RedHat in preference to su.
- #
- if test -f "/sbin/runuser"
- then
- /sbin/runuser - $RUN_AS_USER -c "\"$REALPATH\" $2"
- else
- su - $RUN_AS_USER -c "\"$REALPATH\" $2"
- fi
+ sudo -u $RUN_AS_USER "$REALPATH" "$2"
# Now that we are the original user again, we may need to clean up the lock file.
if [ "X$LOCKPROP" != "X" ]
}
getpid() {
- pid=""
if [ -f "$PIDFILE" ]
then
if [ -r "$PIDFILE" ]
# common is during system startup after an unclean shutdown.
# The ps statement below looks for the specific wrapper command running as
# the pid. If it is not found then the pid file is considered to be stale.
- case "$DIST_OS" in
- 'macosx')
- pidtest=`$PSEXE -ww -p $pid -o command | grep "$WRAPPER_CMD" | tail -1`
- ;;
- *)
- pidtest=`$PSEXE -p $pid -o args | grep "$WRAPPER_CMD" | tail -1`
- ;;
- esac
+
+ dir=`echo ${WRAPPER_CMD:0:60}`
+ #echo "searching for $dir in command args for PID verification..."
+
+ #echo "args for PID: ${pid}:"
+ #echo `$PSEXE -p $pid -o args`
+
+ #echo `$PSEXE -p $pid -o args | grep "$dir"`
+ pidtest=`$PSEXE -p $pid -o args | grep "$dir" | tail -1`
+ if [ "X$pidtest" = "X" ]
+ then
+ # echo "Finding parent of $pid: $PSEXE -p $pid | grep $pid | awk '{print $3}'"
+ parent_pid=`$PSEXE -p $pid -f | grep $pid | awk '{print $3}'`
+ # echo "Parent PID: $parent_pid"
+
+ # echo "args for PID: ${parent_pid}:"
+ # echo `$PSEXE -p $parent_pid -o args`
+
+ pidtest=`$PSEXE -p $parent_pid -o args | grep "$dir" | tail -1`
+ fi
if [ "X$pidtest" = "X" ]
then
fi
}
-getstatus() {
- STATUS=
- if [ -f "$STATUSFILE" ]
- then
- if [ -r "$STATUSFILE" ]
- then
- STATUS=`cat "$STATUSFILE"`
- fi
- fi
- if [ "X$STATUS" = "X" ]
- then
- STATUS="Unknown"
- fi
-
- JAVASTATUS=
- if [ -f "$JAVASTATUSFILE" ]
- then
- if [ -r "$JAVASTATUSFILE" ]
- then
- JAVASTATUS=`cat "$JAVASTATUSFILE"`
- fi
- fi
- if [ "X$JAVASTATUS" = "X" ]
- then
- JAVASTATUS="Unknown"
- fi
-}
-
testpid() {
pid=`$PSEXE -p $pid | grep $pid | grep -v grep | awk '{print $1}' | tail -1`
if [ "X$pid" = "X" ]
if [ "X$pid" = "X" ]
then
# The string passed to eval must handles spaces in paths correctly.
- COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=\"$APP_NAME\" wrapper.pidfile=\"$PIDFILE\" wrapper.name=\"$APP_NAME\" wrapper.displayname=\"$APP_LONG_NAME\" $ANCHORPROP $STATUSPROP $LOCKPROP"
+ COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=$APP_NAME wrapper.pidfile=\"$PIDFILE\" $ANCHORPROP $LOCKPROP"
eval $COMMAND_LINE
else
echo "$APP_LONG_NAME is already running."
exit 1
fi
}
-
+
start() {
- echo -n "Starting $APP_LONG_NAME..."
+ echo "Starting $APP_LONG_NAME..."
getpid
if [ "X$pid" = "X" ]
then
# The string passed to eval must handles spaces in paths correctly.
- COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=\"$APP_NAME\" wrapper.pidfile=\"$PIDFILE\" wrapper.name=\"$APP_NAME\" wrapper.displayname=\"$APP_LONG_NAME\" wrapper.daemonize=TRUE $ANCHORPROP $IGNOREPROP $STATUSPROP $LOCKPROP"
+ COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=$APP_NAME wrapper.pidfile=\"$PIDFILE\" wrapper.daemonize=TRUE $ANCHORPROP $IGNOREPROP $LOCKPROP"
eval $COMMAND_LINE
else
echo "$APP_LONG_NAME is already running."
exit 1
fi
-
- # Sleep for a few seconds to allow for intialization if required
- # then test to make sure we're still running.
- #
- i=0
- while [ $i -lt $WAIT_AFTER_STARTUP ]
- do
- sleep 1
- echo -n "."
- i=`expr $i + 1`
- done
- if [ $WAIT_AFTER_STARTUP -gt 0 ]
- then
- getpid
- if [ "X$pid" = "X" ]
- then
- echo " WARNING: $APP_LONG_NAME may have failed to start."
- exit 1
- else
- echo " running ($pid)."
- fi
- else
- echo ""
- fi
}
-
+
stopit() {
echo "Stopping $APP_LONG_NAME..."
getpid
echo "$APP_LONG_NAME is not running."
exit 1
else
- if [ "X$DETAIL_STATUS" = "X" ]
- then
- echo "$APP_LONG_NAME is running (PID:$pid)."
- else
- getstatus
- echo "$APP_LONG_NAME is running (PID:$pid, Wrapper:$STATUS, Java:$JAVASTATUS)"
- fi
+ echo "$APP_LONG_NAME is running ($pid)."
exit 0
fi
}
if [ "X$pid" = "X" ]
then
echo "$APP_LONG_NAME was not running."
+
else
kill -3 $pid
fi
}
-# Used by HP-UX init scripts.
-startmsg() {
- getpid
- if [ "X$pid" = "X" ]
- then
- echo "Starting $APP_LONG_NAME... (Wrapper:Stopped)"
- else
- if [ "X$DETAIL_STATUS" = "X" ]
- then
- echo "Starting $APP_LONG_NAME... (Wrapper:Running)"
- else
- getstatus
- echo "Starting $APP_LONG_NAME... (Wrapper:$STATUS, Java:$JAVASTATUS)"
- fi
- fi
-}
-
-# Used by HP-UX init scripts.
-stopmsg() {
- getpid
- if [ "X$pid" = "X" ]
- then
- echo "Stopping $APP_LONG_NAME... (Wrapper:Stopped)"
- else
- if [ "X$DETAIL_STATUS" = "X" ]
- then
- echo "Stopping $APP_LONG_NAME... (Wrapper:Running)"
- else
- getstatus
- echo "Stopping $APP_LONG_NAME... (Wrapper:$STATUS, Java:$JAVASTATUS)"
- fi
- fi
-}
-
case "$1" in
'console')
dump
;;
- 'start_msg')
- checkUser "" $1
- startmsg
- ;;
-
- 'stop_msg')
- checkUser "" $1
- stopmsg
- ;;
-
*)
echo "Usage: $0 { console | start | stop | restart | status | dump }"
exit 1
-@echo off\r
-setlocal\r
-\r
-rem Copyright (c) 1999, 2008 Tanuki Software, Inc.\r
-rem http://www.tanukisoftware.com\r
-rem All rights reserved.\r
-rem\r
-rem This software is the confidential and proprietary information\r
-rem of Tanuki Software. ("Confidential Information"). You shall\r
-rem not disclose such Confidential Information and shall use it\r
-rem only in accordance with the terms of the license agreement you\r
-rem entered into with Tanuki Software.\r
-rem\r
-rem Java Service Wrapper general NT service install script.\r
-rem Optimized for use with version 3.3.0 of the Wrapper.\r
-rem\r
-\r
-if "%OS%"=="Windows_NT" goto nt\r
-echo This script only works with NT-based versions of Windows.\r
-goto :eof\r
-\r
-:nt\r
-rem\r
-rem Find the application home.\r
-rem\r
-rem %~dp0 is location of current script under NT\r
-set _REALPATH=%~dp0\r
-\r
-rem Decide on the wrapper binary.\r
-set _WRAPPER_BASE=wrapper\r
-set _WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%-windows-x86-32.exe\r
-if exist "%_WRAPPER_EXE%" goto conf\r
-set _WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%-windows-x86-64.exe\r
-if exist "%_WRAPPER_EXE%" goto conf\r
-set _WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%.exe\r
-if exist "%_WRAPPER_EXE%" goto conf\r
-echo Unable to locate a Wrapper executable using any of the following names:\r
-echo %_REALPATH%%_WRAPPER_BASE%-windows-x86-32.exe\r
-echo %_REALPATH%%_WRAPPER_BASE%-windows-x86-64.exe\r
-echo %_REALPATH%%_WRAPPER_BASE%.exe\r
-pause\r
-goto :eof\r
-\r
-rem\r
-rem Find the wrapper.conf\r
-rem\r
-:conf\r
-set _WRAPPER_CONF="%~f1"\r
-if not %_WRAPPER_CONF%=="" goto startup\r
-set _WRAPPER_CONF="%_REALPATH%..\..\conf\wrapper.conf"\r
-\r
-rem\r
-rem Install the Wrapper as an NT service.\r
-rem\r
-:startup\r
-"%_WRAPPER_EXE%" -i %_WRAPPER_CONF%\r
-if not errorlevel 1 goto :eof\r
-pause\r
-\r
+@echo off
+setlocal
+
+rem Copyright (c) 1999, 2006 Tanuki Software Inc.
+rem
+rem Java Service Wrapper general NT service install script
+rem
+
+if "%OS%"=="Windows_NT" goto nt
+echo This script only works with NT-based versions of Windows.
+goto :eof
+
+:nt
+rem
+rem Find the application home.
+rem
+rem %~dp0 is location of current script under NT
+set _REALPATH=%~dp0
+
+rem Decide on the wrapper binary.
+set _WRAPPER_BASE=wrapper
+set _WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%-windows-x86-32.exe
+if exist "%_WRAPPER_EXE%" goto conf
+set _WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%-windows-x86-64.exe
+if exist "%_WRAPPER_EXE%" goto conf
+set _WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%.exe
+if exist "%_WRAPPER_EXE%" goto conf
+echo Unable to locate a Wrapper executable using any of the following names:
+echo %_REALPATH%%_WRAPPER_BASE%-windows-x86-32.exe
+echo %_REALPATH%%_WRAPPER_BASE%-windows-x86-64.exe
+echo %_REALPATH%%_WRAPPER_BASE%.exe
+pause
+goto :eof
+
+rem
+rem Find the wrapper.conf
+rem
+:conf
+set _WRAPPER_CONF="%~f1"
+if not %_WRAPPER_CONF%=="" goto startup
+set _WRAPPER_CONF="%_REALPATH%..\..\conf\wrapper.conf"
+
+rem
+rem Install the Wrapper as an NT service.
+rem
+:startup
+"%_WRAPPER_EXE%" -i %_WRAPPER_CONF%
+if not errorlevel 1 goto :eof
+pause
+
-@echo off\r
-setlocal\r
-\r
-rem Copyright (c) 1999, 2008 Tanuki Software, Inc.\r
-rem http://www.tanukisoftware.com\r
-rem All rights reserved.\r
-rem\r
-rem This software is the confidential and proprietary information\r
-rem of Tanuki Software. ("Confidential Information"). You shall\r
-rem not disclose such Confidential Information and shall use it\r
-rem only in accordance with the terms of the license agreement you\r
-rem entered into with Tanuki Software.\r
-rem\r
-rem Java Service Wrapper general NT service start script.\r
-rem Optimized for use with version 3.3.0 of the Wrapper.\r
-rem\r
-\r
-if "%OS%"=="Windows_NT" goto nt\r
-echo This script only works with NT-based versions of Windows.\r
-goto :eof\r
-\r
-:nt\r
-rem\r
-rem Find the application home.\r
-rem\r
-rem %~dp0 is location of current script under NT\r
-set _REALPATH=%~dp0\r
-\r
-rem Decide on the wrapper binary.\r
-set _WRAPPER_BASE=wrapper\r
-set _WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%-windows-x86-32.exe\r
-if exist "%_WRAPPER_EXE%" goto conf\r
-set _WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%-windows-x86-64.exe\r
-if exist "%_WRAPPER_EXE%" goto conf\r
-set _WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%.exe\r
-if exist "%_WRAPPER_EXE%" goto conf\r
-echo Unable to locate a Wrapper executable using any of the following names:\r
-echo %_REALPATH%%_WRAPPER_BASE%-windows-x86-32.exe\r
-echo %_REALPATH%%_WRAPPER_BASE%-windows-x86-64.exe\r
-echo %_REALPATH%%_WRAPPER_BASE%.exe\r
-pause\r
-goto :eof\r
-\r
-rem\r
-rem Find the wrapper.conf\r
-rem\r
-:conf\r
-set _WRAPPER_CONF="%~f1"\r
-if not %_WRAPPER_CONF%=="" goto startup\r
-set _WRAPPER_CONF="%_REALPATH%..\..\conf\wrapper.conf"\r
-\r
-rem\r
-rem Start the Wrapper NT service.\r
-rem\r
-:startup\r
-"%_WRAPPER_EXE%" -t %_WRAPPER_CONF%\r
-if not errorlevel 1 goto :eof\r
-pause\r
-\r
+@echo off
+setlocal
+
+rem Copyright (c) 1999, 2006 Tanuki Software Inc.
+rem
+rem Java Service Wrapper general NT service start script
+rem
+
+if "%OS%"=="Windows_NT" goto nt
+echo This script only works with NT-based versions of Windows.
+goto :eof
+
+:nt
+rem
+rem Find the application home.
+rem
+rem %~dp0 is location of current script under NT
+set _REALPATH=%~dp0
+
+rem Decide on the wrapper binary.
+set _WRAPPER_BASE=wrapper
+set _WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%-windows-x86-32.exe
+if exist "%_WRAPPER_EXE%" goto conf
+set _WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%-windows-x86-64.exe
+if exist "%_WRAPPER_EXE%" goto conf
+set _WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%.exe
+if exist "%_WRAPPER_EXE%" goto conf
+echo Unable to locate a Wrapper executable using any of the following names:
+echo %_REALPATH%%_WRAPPER_BASE%-windows-x86-32.exe
+echo %_REALPATH%%_WRAPPER_BASE%-windows-x86-64.exe
+echo %_REALPATH%%_WRAPPER_BASE%.exe
+pause
+goto :eof
+
+rem
+rem Find the wrapper.conf
+rem
+:conf
+set _WRAPPER_CONF="%~f1"
+if not %_WRAPPER_CONF%=="" goto startup
+set _WRAPPER_CONF="%_REALPATH%..\..\conf\wrapper.conf"
+
+rem
+rem Start the Wrapper NT service.
+rem
+:startup
+"%_WRAPPER_EXE%" -t %_WRAPPER_CONF%
+if not errorlevel 1 goto :eof
+pause
+
-@echo off\r
-setlocal\r
-\r
-rem Copyright (c) 1999, 2008 Tanuki Software, Inc.\r
-rem http://www.tanukisoftware.com\r
-rem All rights reserved.\r
-rem\r
-rem This software is the confidential and proprietary information\r
-rem of Tanuki Software. ("Confidential Information"). You shall\r
-rem not disclose such Confidential Information and shall use it\r
-rem only in accordance with the terms of the license agreement you\r
-rem entered into with Tanuki Software.\r
-rem\r
-rem Java Service Wrapper general startup script.\r
-rem Optimized for use with version 3.3.0 of the Wrapper.\r
-rem\r
-\r
-rem\r
-rem Resolve the real path of the wrapper.exe\r
-rem For non NT systems, the _REALPATH and _WRAPPER_CONF values\r
-rem can be hard-coded below and the following test removed.\r
-rem\r
-if "%OS%"=="Windows_NT" goto nt\r
-echo This script only works with NT-based versions of Windows.\r
-goto :eof\r
-\r
-:nt\r
-rem\r
-rem Find the application home.\r
-rem\r
-rem %~dp0 is location of current script under NT\r
-set _REALPATH=%~dp0\r
-\r
-rem Decide on the wrapper binary.\r
-set _WRAPPER_BASE=wrapper\r
-set _WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%-windows-x86-32.exe\r
-if exist "%_WRAPPER_EXE%" goto conf\r
-set _WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%-windows-x86-64.exe\r
-if exist "%_WRAPPER_EXE%" goto conf\r
-set _WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%.exe\r
-if exist "%_WRAPPER_EXE%" goto conf\r
-echo Unable to locate a Wrapper executable using any of the following names:\r
-echo %_REALPATH%%_WRAPPER_BASE%-windows-x86-32.exe\r
-echo %_REALPATH%%_WRAPPER_BASE%-windows-x86-64.exe\r
-echo %_REALPATH%%_WRAPPER_BASE%.exe\r
-pause\r
-goto :eof\r
-\r
-rem\r
-rem Find the wrapper.conf\r
-rem\r
-:conf\r
-set _WRAPPER_CONF="%~f1"\r
-if not %_WRAPPER_CONF%=="" goto startup\r
-set _WRAPPER_CONF="%_REALPATH%..\..\conf\wrapper.conf"\r
-\r
-rem\r
-rem Start the Wrapper\r
-rem\r
-:startup\r
-"%_WRAPPER_EXE%" -c %_WRAPPER_CONF%\r
-if not errorlevel 1 goto :eof\r
-pause\r
-\r
+@echo off
+setlocal
+
+rem Copyright (c) 1999, 2006 Tanuki Software Inc.
+rem
+rem Java Service Wrapper general startup script
+rem
+
+rem
+rem Resolve the real path of the wrapper.exe
+rem For non NT systems, the _REALPATH and _WRAPPER_CONF values
+rem can be hard-coded below and the following test removed.
+rem
+if "%OS%"=="Windows_NT" goto nt
+echo This script only works with NT-based versions of Windows.
+goto :eof
+
+:nt
+rem
+rem Find the application home.
+rem
+rem %~dp0 is location of current script under NT
+set _REALPATH=%~dp0
+
+rem Decide on the wrapper binary.
+set _WRAPPER_BASE=wrapper
+set _WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%-windows-x86-32.exe
+if exist "%_WRAPPER_EXE%" goto conf
+set _WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%-windows-x86-64.exe
+if exist "%_WRAPPER_EXE%" goto conf
+set _WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%.exe
+if exist "%_WRAPPER_EXE%" goto conf
+echo Unable to locate a Wrapper executable using any of the following names:
+echo %_REALPATH%%_WRAPPER_BASE%-windows-x86-32.exe
+echo %_REALPATH%%_WRAPPER_BASE%-windows-x86-64.exe
+echo %_REALPATH%%_WRAPPER_BASE%.exe
+pause
+goto :eof
+
+rem
+rem Find the wrapper.conf
+rem
+:conf
+set _WRAPPER_CONF="%~f1"
+if not %_WRAPPER_CONF%=="" goto startup
+set _WRAPPER_CONF="%_REALPATH%..\..\conf\wrapper.conf"
+
+rem
+rem Start the Wrapper
+rem
+:startup
+"%_WRAPPER_EXE%" -c %_WRAPPER_CONF%
+if not errorlevel 1 goto :eof
+pause
+
-@echo off\r
-setlocal\r
-\r
-rem Copyright (c) 1999, 2008 Tanuki Software, Inc.\r
-rem http://www.tanukisoftware.com\r
-rem All rights reserved.\r
-rem\r
-rem This software is the confidential and proprietary information\r
-rem of Tanuki Software. ("Confidential Information"). You shall\r
-rem not disclose such Confidential Information and shall use it\r
-rem only in accordance with the terms of the license agreement you\r
-rem entered into with Tanuki Software.\r
-rem\r
-rem Java Service Wrapper general NT service stop script.\r
-rem Optimized for use with version 3.3.0 of the Wrapper.\r
-rem\r
-\r
-if "%OS%"=="Windows_NT" goto nt\r
-echo This script only works with NT-based versions of Windows.\r
-goto :eof\r
-\r
-:nt\r
-rem\r
-rem Find the application home.\r
-rem\r
-rem %~dp0 is location of current script under NT\r
-set _REALPATH=%~dp0\r
-\r
-rem Decide on the wrapper binary.\r
-set _WRAPPER_BASE=wrapper\r
-set _WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%-windows-x86-32.exe\r
-if exist "%_WRAPPER_EXE%" goto conf\r
-set _WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%-windows-x86-64.exe\r
-if exist "%_WRAPPER_EXE%" goto conf\r
-set _WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%.exe\r
-if exist "%_WRAPPER_EXE%" goto conf\r
-echo Unable to locate a Wrapper executable using any of the following names:\r
-echo %_REALPATH%%_WRAPPER_BASE%-windows-x86-32.exe\r
-echo %_REALPATH%%_WRAPPER_BASE%-windows-x86-64.exe\r
-echo %_REALPATH%%_WRAPPER_BASE%.exe\r
-pause\r
-goto :eof\r
-\r
-rem\r
-rem Find the wrapper.conf\r
-rem\r
-:conf\r
-set _WRAPPER_CONF="%~f1"\r
-if not %_WRAPPER_CONF%=="" goto startup\r
-set _WRAPPER_CONF="%_REALPATH%..\..\conf\wrapper.conf"\r
-\r
-rem\r
-rem Stop the Wrapper NT service.\r
-rem\r
-:startup\r
-"%_WRAPPER_EXE%" -p %_WRAPPER_CONF%\r
-if not errorlevel 1 goto :eof\r
-pause\r
-\r
+@echo off
+setlocal
+
+rem Copyright (c) 1999, 2006 Tanuki Software Inc.
+rem
+rem Java Service Wrapper general NT service stop script
+rem
+
+if "%OS%"=="Windows_NT" goto nt
+echo This script only works with NT-based versions of Windows.
+goto :eof
+
+:nt
+rem
+rem Find the application home.
+rem
+rem %~dp0 is location of current script under NT
+set _REALPATH=%~dp0
+
+rem Decide on the wrapper binary.
+set _WRAPPER_BASE=wrapper
+set _WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%-windows-x86-32.exe
+if exist "%_WRAPPER_EXE%" goto conf
+set _WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%-windows-x86-64.exe
+if exist "%_WRAPPER_EXE%" goto conf
+set _WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%.exe
+if exist "%_WRAPPER_EXE%" goto conf
+echo Unable to locate a Wrapper executable using any of the following names:
+echo %_REALPATH%%_WRAPPER_BASE%-windows-x86-32.exe
+echo %_REALPATH%%_WRAPPER_BASE%-windows-x86-64.exe
+echo %_REALPATH%%_WRAPPER_BASE%.exe
+pause
+goto :eof
+
+rem
+rem Find the wrapper.conf
+rem
+:conf
+set _WRAPPER_CONF="%~f1"
+if not %_WRAPPER_CONF%=="" goto startup
+set _WRAPPER_CONF="%_REALPATH%..\..\conf\wrapper.conf"
+
+rem
+rem Stop the Wrapper NT service.
+rem
+:startup
+"%_WRAPPER_EXE%" -p %_WRAPPER_CONF%
+if not errorlevel 1 goto :eof
+pause
+
-@echo off\r
-setlocal\r
-\r
-rem Copyright (c) 1999, 2008 Tanuki Software, Inc.\r
-rem http://www.tanukisoftware.com\r
-rem All rights reserved.\r
-rem\r
-rem This software is the confidential and proprietary information\r
-rem of Tanuki Software. ("Confidential Information"). You shall\r
-rem not disclose such Confidential Information and shall use it\r
-rem only in accordance with the terms of the license agreement you\r
-rem entered into with Tanuki Software.\r
-rem\r
-rem Java Service Wrapper general NT service uninstall script.\r
-rem Optimized for use with version 3.3.0 of the Wrapper.\r
-rem\r
-\r
-if "%OS%"=="Windows_NT" goto nt\r
-echo This script only works with NT-based versions of Windows.\r
-goto :eof\r
-\r
-:nt\r
-rem\r
-rem Find the application home.\r
-rem\r
-rem %~dp0 is location of current script under NT\r
-set _REALPATH=%~dp0\r
-\r
-rem Decide on the wrapper binary.\r
-set _WRAPPER_BASE=wrapper\r
-set _WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%-windows-x86-32.exe\r
-if exist "%_WRAPPER_EXE%" goto conf\r
-set _WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%-windows-x86-64.exe\r
-if exist "%_WRAPPER_EXE%" goto conf\r
-set _WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%.exe\r
-if exist "%_WRAPPER_EXE%" goto conf\r
-echo Unable to locate a Wrapper executable using any of the following names:\r
-echo %_REALPATH%%_WRAPPER_BASE%-windows-x86-32.exe\r
-echo %_REALPATH%%_WRAPPER_BASE%-windows-x86-64.exe\r
-echo %_REALPATH%%_WRAPPER_BASE%.exe\r
-pause\r
-goto :eof\r
-\r
-rem\r
-rem Find the wrapper.conf\r
-rem\r
-:conf\r
-set _WRAPPER_CONF="%~f1"\r
-if not %_WRAPPER_CONF%=="" goto startup\r
-set _WRAPPER_CONF="%_REALPATH%..\..\conf\wrapper.conf"\r
-\r
-rem\r
-rem Uninstall the Wrapper as an NT service.\r
-rem\r
-:startup\r
-"%_WRAPPER_EXE%" -r %_WRAPPER_CONF%\r
-if not errorlevel 1 goto :eof\r
-pause\r
-\r
+@echo off
+setlocal
+
+rem Copyright (c) 1999, 2006 Tanuki Software Inc.
+rem
+rem Java Service Wrapper general NT service uninstall script
+rem
+
+if "%OS%"=="Windows_NT" goto nt
+echo This script only works with NT-based versions of Windows.
+goto :eof
+
+:nt
+rem
+rem Find the application home.
+rem
+rem %~dp0 is location of current script under NT
+set _REALPATH=%~dp0
+
+rem Decide on the wrapper binary.
+set _WRAPPER_BASE=wrapper
+set _WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%-windows-x86-32.exe
+if exist "%_WRAPPER_EXE%" goto conf
+set _WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%-windows-x86-64.exe
+if exist "%_WRAPPER_EXE%" goto conf
+set _WRAPPER_EXE=%_REALPATH%%_WRAPPER_BASE%.exe
+if exist "%_WRAPPER_EXE%" goto conf
+echo Unable to locate a Wrapper executable using any of the following names:
+echo %_REALPATH%%_WRAPPER_BASE%-windows-x86-32.exe
+echo %_REALPATH%%_WRAPPER_BASE%-windows-x86-64.exe
+echo %_REALPATH%%_WRAPPER_BASE%.exe
+pause
+goto :eof
+
+rem
+rem Find the wrapper.conf
+rem
+:conf
+set _WRAPPER_CONF="%~f1"
+if not %_WRAPPER_CONF%=="" goto startup
+set _WRAPPER_CONF="%_REALPATH%..\..\conf\wrapper.conf"
+
+rem
+rem Uninstall the Wrapper as an NT service.
+rem
+:startup
+"%_WRAPPER_EXE%" -r %_WRAPPER_CONF%
+if not errorlevel 1 goto :eof
+pause
+
@echo off
setlocal
-rem Copyright (c) 1999, 2008 Tanuki Software, Inc.
-rem http://www.tanukisoftware.com
-rem All rights reserved.
-rem
-rem This software is the confidential and proprietary information
-rem of Tanuki Software. ("Confidential Information"). You shall
-rem not disclose such Confidential Information and shall use it
-rem only in accordance with the terms of the license agreement you
-rem entered into with Tanuki Software.
-rem
-rem Java Service Wrapper general NT service install script.
-rem Optimized for use with version 3.3.0 of the Wrapper.
+rem Copyright (c) 1999, 2006 Tanuki Software Inc.
+rem
+rem Java Service Wrapper general NT service install script
rem
if "%OS%"=="Windows_NT" goto nt
@echo off
setlocal
-rem Copyright (c) 1999, 2008 Tanuki Software, Inc.
-rem http://www.tanukisoftware.com
-rem All rights reserved.
-rem
-rem This software is the confidential and proprietary information
-rem of Tanuki Software. ("Confidential Information"). You shall
-rem not disclose such Confidential Information and shall use it
-rem only in accordance with the terms of the license agreement you
-rem entered into with Tanuki Software.
-rem
-rem Java Service Wrapper general NT service start script.
-rem Optimized for use with version 3.3.0 of the Wrapper.
+rem Copyright (c) 1999, 2006 Tanuki Software Inc.
+rem
+rem Java Service Wrapper general NT service start script
rem
if "%OS%"=="Windows_NT" goto nt
@echo off
setlocal
-rem Copyright (c) 1999, 2008 Tanuki Software, Inc.
-rem http://www.tanukisoftware.com
-rem All rights reserved.
+rem Copyright (c) 1999, 2006 Tanuki Software Inc.
rem
-rem This software is the confidential and proprietary information
-rem of Tanuki Software. ("Confidential Information"). You shall
-rem not disclose such Confidential Information and shall use it
-rem only in accordance with the terms of the license agreement you
-rem entered into with Tanuki Software.
-rem
-rem Java Service Wrapper general startup script.
-rem Optimized for use with version 3.3.0 of the Wrapper.
+rem Java Service Wrapper general startup script
rem
rem
@echo off
setlocal
-rem Copyright (c) 1999, 2008 Tanuki Software, Inc.
-rem http://www.tanukisoftware.com
-rem All rights reserved.
-rem
-rem This software is the confidential and proprietary information
-rem of Tanuki Software. ("Confidential Information"). You shall
-rem not disclose such Confidential Information and shall use it
-rem only in accordance with the terms of the license agreement you
-rem entered into with Tanuki Software.
-rem
-rem Java Service Wrapper general NT service stop script.
-rem Optimized for use with version 3.3.0 of the Wrapper.
+rem Copyright (c) 1999, 2006 Tanuki Software Inc.
+rem
+rem Java Service Wrapper general NT service stop script
rem
if "%OS%"=="Windows_NT" goto nt
@echo off
setlocal
-rem Copyright (c) 1999, 2008 Tanuki Software, Inc.
-rem http://www.tanukisoftware.com
-rem All rights reserved.
-rem
-rem This software is the confidential and proprietary information
-rem of Tanuki Software. ("Confidential Information"). You shall
-rem not disclose such Confidential Information and shall use it
-rem only in accordance with the terms of the license agreement you
-rem entered into with Tanuki Software.
-rem
-rem Java Service Wrapper general NT service uninstall script.
-rem Optimized for use with version 3.3.0 of the Wrapper.
+rem Copyright (c) 1999, 2006 Tanuki Software Inc.
+rem
+rem Java Service Wrapper general NT service uninstall script
rem
if "%OS%"=="Windows_NT" goto nt