diff options
20 files changed, 1032 insertions, 2193 deletions
diff --git a/sonar-application/src/main/assembly/bin/linux-ppc-64/sonar.sh b/sonar-application/src/main/assembly/bin/linux-ppc-64/sonar.sh index 1db51aba0d0..c080399c62c 100755 --- a/sonar-application/src/main/assembly/bin/linux-ppc-64/sonar.sh +++ b/sonar-application/src/main/assembly/bin/linux-ppc-64/sonar.sh @@ -1,15 +1,7 @@ #! /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. @@ -17,11 +9,17 @@ #----------------------------------------------------------------------------- # 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" @@ -39,19 +37,6 @@ PIDDIR="." # 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 @@ -65,20 +50,7 @@ WAIT_AFTER_STARTUP=0 # 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 #----------------------------------------------------------------------------- @@ -155,8 +127,6 @@ fi # 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" @@ -182,10 +152,7 @@ case "$DIST_OS" in 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" @@ -196,52 +163,31 @@ case "$DIST_OS" in 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" ] @@ -256,23 +202,56 @@ outputFile() { # 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 @@ -295,14 +274,6 @@ else 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 ] @@ -349,7 +320,7 @@ checkUser() { 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 @@ -362,15 +333,7 @@ checkUser() { # 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" ] @@ -391,7 +354,6 @@ checkUser() { } getpid() { - pid="" if [ -f "$PIDFILE" ] then if [ -r "$PIDFILE" ] @@ -404,15 +366,7 @@ getpid() { # 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. @@ -428,34 +382,6 @@ getpid() { 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" ] @@ -472,52 +398,35 @@ console() { 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 @@ -587,13 +496,7 @@ status() { 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 } @@ -604,6 +507,7 @@ dump() { if [ "X$pid" = "X" ] then echo "$APP_LONG_NAME was not running." + else kill -3 $pid @@ -617,40 +521,6 @@ dump() { 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') @@ -684,16 +554,6 @@ case "$1" in dump ;; - 'start_msg') - checkUser "" $1 - startmsg - ;; - - 'stop_msg') - checkUser "" $1 - stopmsg - ;; - *) echo "Usage: $0 { console | start | stop | restart | status | dump }" exit 1 diff --git a/sonar-application/src/main/assembly/bin/linux-x86-32/sonar.sh b/sonar-application/src/main/assembly/bin/linux-x86-32/sonar.sh index 1db51aba0d0..c080399c62c 100755 --- a/sonar-application/src/main/assembly/bin/linux-x86-32/sonar.sh +++ b/sonar-application/src/main/assembly/bin/linux-x86-32/sonar.sh @@ -1,15 +1,7 @@ #! /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. @@ -17,11 +9,17 @@ #----------------------------------------------------------------------------- # 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" @@ -39,19 +37,6 @@ PIDDIR="." # 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 @@ -65,20 +50,7 @@ WAIT_AFTER_STARTUP=0 # 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 #----------------------------------------------------------------------------- @@ -155,8 +127,6 @@ fi # 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" @@ -182,10 +152,7 @@ case "$DIST_OS" in 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" @@ -196,52 +163,31 @@ case "$DIST_OS" in 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" ] @@ -256,23 +202,56 @@ outputFile() { # 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 @@ -295,14 +274,6 @@ else 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 ] @@ -349,7 +320,7 @@ checkUser() { 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 @@ -362,15 +333,7 @@ checkUser() { # 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" ] @@ -391,7 +354,6 @@ checkUser() { } getpid() { - pid="" if [ -f "$PIDFILE" ] then if [ -r "$PIDFILE" ] @@ -404,15 +366,7 @@ getpid() { # 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. @@ -428,34 +382,6 @@ getpid() { 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" ] @@ -472,52 +398,35 @@ console() { 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 @@ -587,13 +496,7 @@ status() { 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 } @@ -604,6 +507,7 @@ dump() { if [ "X$pid" = "X" ] then echo "$APP_LONG_NAME was not running." + else kill -3 $pid @@ -617,40 +521,6 @@ dump() { 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') @@ -684,16 +554,6 @@ case "$1" in dump ;; - 'start_msg') - checkUser "" $1 - startmsg - ;; - - 'stop_msg') - checkUser "" $1 - stopmsg - ;; - *) echo "Usage: $0 { console | start | stop | restart | status | dump }" exit 1 diff --git a/sonar-application/src/main/assembly/bin/linux-x86-64/sonar.sh b/sonar-application/src/main/assembly/bin/linux-x86-64/sonar.sh index 1db51aba0d0..c080399c62c 100755 --- a/sonar-application/src/main/assembly/bin/linux-x86-64/sonar.sh +++ b/sonar-application/src/main/assembly/bin/linux-x86-64/sonar.sh @@ -1,15 +1,7 @@ #! /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. @@ -17,11 +9,17 @@ #----------------------------------------------------------------------------- # 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" @@ -39,19 +37,6 @@ PIDDIR="." # 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 @@ -65,20 +50,7 @@ WAIT_AFTER_STARTUP=0 # 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 #----------------------------------------------------------------------------- @@ -155,8 +127,6 @@ fi # 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" @@ -182,10 +152,7 @@ case "$DIST_OS" in 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" @@ -196,52 +163,31 @@ case "$DIST_OS" in 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" ] @@ -256,23 +202,56 @@ outputFile() { # 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 @@ -295,14 +274,6 @@ else 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 ] @@ -349,7 +320,7 @@ checkUser() { 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 @@ -362,15 +333,7 @@ checkUser() { # 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" ] @@ -391,7 +354,6 @@ checkUser() { } getpid() { - pid="" if [ -f "$PIDFILE" ] then if [ -r "$PIDFILE" ] @@ -404,15 +366,7 @@ getpid() { # 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. @@ -428,34 +382,6 @@ getpid() { 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" ] @@ -472,52 +398,35 @@ console() { 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 @@ -587,13 +496,7 @@ status() { 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 } @@ -604,6 +507,7 @@ dump() { if [ "X$pid" = "X" ] then echo "$APP_LONG_NAME was not running." + else kill -3 $pid @@ -617,40 +521,6 @@ dump() { 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') @@ -684,16 +554,6 @@ case "$1" in dump ;; - 'start_msg') - checkUser "" $1 - startmsg - ;; - - 'stop_msg') - checkUser "" $1 - stopmsg - ;; - *) echo "Usage: $0 { console | start | stop | restart | status | dump }" exit 1 diff --git a/sonar-application/src/main/assembly/bin/macosx-universal-32/sonar.sh b/sonar-application/src/main/assembly/bin/macosx-universal-32/sonar.sh index 1db51aba0d0..6ad48536cc5 100755 --- a/sonar-application/src/main/assembly/bin/macosx-universal-32/sonar.sh +++ b/sonar-application/src/main/assembly/bin/macosx-universal-32/sonar.sh @@ -1,15 +1,7 @@ #! /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. @@ -17,11 +9,17 @@ #----------------------------------------------------------------------------- # 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" @@ -39,19 +37,6 @@ PIDDIR="." # 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 @@ -65,20 +50,7 @@ WAIT_AFTER_STARTUP=0 # 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 #----------------------------------------------------------------------------- @@ -155,8 +127,6 @@ fi # 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" @@ -182,10 +152,7 @@ case "$DIST_OS" in 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" @@ -196,52 +163,31 @@ case "$DIST_OS" in 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" ] @@ -256,23 +202,56 @@ outputFile() { # 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 @@ -295,14 +274,6 @@ else 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 ] @@ -349,7 +320,7 @@ checkUser() { 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 @@ -362,15 +333,7 @@ checkUser() { # 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" ] @@ -391,7 +354,6 @@ checkUser() { } getpid() { - pid="" if [ -f "$PIDFILE" ] then if [ -r "$PIDFILE" ] @@ -412,7 +374,6 @@ getpid() { pidtest=`$PSEXE -p $pid -o args | grep "$WRAPPER_CMD" | tail -1` ;; esac - if [ "X$pidtest" = "X" ] then # This is a stale pid file. @@ -428,34 +389,6 @@ getpid() { 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" ] @@ -472,52 +405,35 @@ console() { 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 @@ -587,13 +503,7 @@ status() { 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 } @@ -604,6 +514,7 @@ dump() { if [ "X$pid" = "X" ] then echo "$APP_LONG_NAME was not running." + else kill -3 $pid @@ -617,40 +528,6 @@ dump() { 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') @@ -684,16 +561,6 @@ case "$1" in dump ;; - 'start_msg') - checkUser "" $1 - startmsg - ;; - - 'stop_msg') - checkUser "" $1 - stopmsg - ;; - *) echo "Usage: $0 { console | start | stop | restart | status | dump }" exit 1 diff --git a/sonar-application/src/main/assembly/bin/macosx-universal-64/sonar.sh b/sonar-application/src/main/assembly/bin/macosx-universal-64/sonar.sh index 1db51aba0d0..6ad48536cc5 100755 --- a/sonar-application/src/main/assembly/bin/macosx-universal-64/sonar.sh +++ b/sonar-application/src/main/assembly/bin/macosx-universal-64/sonar.sh @@ -1,15 +1,7 @@ #! /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. @@ -17,11 +9,17 @@ #----------------------------------------------------------------------------- # 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" @@ -39,19 +37,6 @@ PIDDIR="." # 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 @@ -65,20 +50,7 @@ WAIT_AFTER_STARTUP=0 # 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 #----------------------------------------------------------------------------- @@ -155,8 +127,6 @@ fi # 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" @@ -182,10 +152,7 @@ case "$DIST_OS" in 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" @@ -196,52 +163,31 @@ case "$DIST_OS" in 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" ] @@ -256,23 +202,56 @@ outputFile() { # 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 @@ -295,14 +274,6 @@ else 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 ] @@ -349,7 +320,7 @@ checkUser() { 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 @@ -362,15 +333,7 @@ checkUser() { # 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" ] @@ -391,7 +354,6 @@ checkUser() { } getpid() { - pid="" if [ -f "$PIDFILE" ] then if [ -r "$PIDFILE" ] @@ -412,7 +374,6 @@ getpid() { pidtest=`$PSEXE -p $pid -o args | grep "$WRAPPER_CMD" | tail -1` ;; esac - if [ "X$pidtest" = "X" ] then # This is a stale pid file. @@ -428,34 +389,6 @@ getpid() { 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" ] @@ -472,52 +405,35 @@ console() { 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 @@ -587,13 +503,7 @@ status() { 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 } @@ -604,6 +514,7 @@ dump() { if [ "X$pid" = "X" ] then echo "$APP_LONG_NAME was not running." + else kill -3 $pid @@ -617,40 +528,6 @@ dump() { 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') @@ -684,16 +561,6 @@ case "$1" in dump ;; - 'start_msg') - checkUser "" $1 - startmsg - ;; - - 'stop_msg') - checkUser "" $1 - stopmsg - ;; - *) echo "Usage: $0 { console | start | stop | restart | status | dump }" exit 1 diff --git a/sonar-application/src/main/assembly/bin/solaris-sparc-32/sonar.sh b/sonar-application/src/main/assembly/bin/solaris-sparc-32/sonar.sh index 1db51aba0d0..154e3289218 100755 --- a/sonar-application/src/main/assembly/bin/solaris-sparc-32/sonar.sh +++ b/sonar-application/src/main/assembly/bin/solaris-sparc-32/sonar.sh @@ -1,15 +1,7 @@ #! /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. @@ -17,11 +9,17 @@ #----------------------------------------------------------------------------- # 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" @@ -39,19 +37,6 @@ PIDDIR="." # 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 @@ -65,20 +50,7 @@ WAIT_AFTER_STARTUP=0 # 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 #----------------------------------------------------------------------------- @@ -155,8 +127,6 @@ fi # 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" @@ -180,12 +150,10 @@ DIST_OS=`uname -s | tr [:upper:] [:lower:] | tr -d [:blank:]` 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" @@ -196,52 +164,31 @@ case "$DIST_OS" in 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" ] @@ -256,23 +203,56 @@ outputFile() { # 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 @@ -295,14 +275,6 @@ else 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 ] @@ -349,7 +321,7 @@ checkUser() { 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 @@ -362,15 +334,7 @@ checkUser() { # 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" ] @@ -391,7 +355,6 @@ checkUser() { } getpid() { - pid="" if [ -f "$PIDFILE" ] then if [ -r "$PIDFILE" ] @@ -404,15 +367,12 @@ getpid() { # 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. @@ -428,36 +388,13 @@ getpid() { 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. @@ -472,52 +409,35 @@ console() { 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 @@ -587,13 +507,7 @@ status() { 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 } @@ -604,6 +518,7 @@ dump() { if [ "X$pid" = "X" ] then echo "$APP_LONG_NAME was not running." + else kill -3 $pid @@ -617,40 +532,6 @@ dump() { 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') @@ -684,16 +565,6 @@ case "$1" in dump ;; - 'start_msg') - checkUser "" $1 - startmsg - ;; - - 'stop_msg') - checkUser "" $1 - stopmsg - ;; - *) echo "Usage: $0 { console | start | stop | restart | status | dump }" exit 1 diff --git a/sonar-application/src/main/assembly/bin/solaris-sparc-64/sonar.sh b/sonar-application/src/main/assembly/bin/solaris-sparc-64/sonar.sh index 1db51aba0d0..154e3289218 100755 --- a/sonar-application/src/main/assembly/bin/solaris-sparc-64/sonar.sh +++ b/sonar-application/src/main/assembly/bin/solaris-sparc-64/sonar.sh @@ -1,15 +1,7 @@ #! /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. @@ -17,11 +9,17 @@ #----------------------------------------------------------------------------- # 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" @@ -39,19 +37,6 @@ PIDDIR="." # 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 @@ -65,20 +50,7 @@ WAIT_AFTER_STARTUP=0 # 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 #----------------------------------------------------------------------------- @@ -155,8 +127,6 @@ fi # 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" @@ -180,12 +150,10 @@ DIST_OS=`uname -s | tr [:upper:] [:lower:] | tr -d [:blank:]` 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" @@ -196,52 +164,31 @@ case "$DIST_OS" in 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" ] @@ -256,23 +203,56 @@ outputFile() { # 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 @@ -295,14 +275,6 @@ else 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 ] @@ -349,7 +321,7 @@ checkUser() { 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 @@ -362,15 +334,7 @@ checkUser() { # 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" ] @@ -391,7 +355,6 @@ checkUser() { } getpid() { - pid="" if [ -f "$PIDFILE" ] then if [ -r "$PIDFILE" ] @@ -404,15 +367,12 @@ getpid() { # 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. @@ -428,36 +388,13 @@ getpid() { 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. @@ -472,52 +409,35 @@ console() { 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 @@ -587,13 +507,7 @@ status() { 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 } @@ -604,6 +518,7 @@ dump() { if [ "X$pid" = "X" ] then echo "$APP_LONG_NAME was not running." + else kill -3 $pid @@ -617,40 +532,6 @@ dump() { 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') @@ -684,16 +565,6 @@ case "$1" in dump ;; - 'start_msg') - checkUser "" $1 - startmsg - ;; - - 'stop_msg') - checkUser "" $1 - stopmsg - ;; - *) echo "Usage: $0 { console | start | stop | restart | status | dump }" exit 1 diff --git a/sonar-application/src/main/assembly/bin/solaris-x86-32/sonar.sh b/sonar-application/src/main/assembly/bin/solaris-x86-32/sonar.sh index 1db51aba0d0..7b2d58a7935 100755 --- a/sonar-application/src/main/assembly/bin/solaris-x86-32/sonar.sh +++ b/sonar-application/src/main/assembly/bin/solaris-x86-32/sonar.sh @@ -1,15 +1,7 @@ #! /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. @@ -17,11 +9,17 @@ #----------------------------------------------------------------------------- # 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" @@ -39,19 +37,6 @@ PIDDIR="." # 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 @@ -60,25 +45,12 @@ WAIT_AFTER_STARTUP=0 # 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 #----------------------------------------------------------------------------- @@ -155,8 +127,6 @@ fi # 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" @@ -182,10 +152,7 @@ case "$DIST_OS" in 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" @@ -196,52 +163,31 @@ case "$DIST_OS" in 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" ] @@ -256,23 +202,56 @@ outputFile() { # 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 @@ -295,14 +274,6 @@ else 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 ] @@ -349,7 +320,7 @@ checkUser() { 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 @@ -362,15 +333,7 @@ checkUser() { # 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" ] @@ -391,7 +354,6 @@ checkUser() { } getpid() { - pid="" if [ -f "$PIDFILE" ] then if [ -r "$PIDFILE" ] @@ -404,14 +366,26 @@ getpid() { # 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 @@ -428,34 +402,6 @@ getpid() { 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" ] @@ -472,52 +418,28 @@ console() { 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 @@ -587,13 +509,7 @@ status() { 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 } @@ -604,6 +520,7 @@ dump() { if [ "X$pid" = "X" ] then echo "$APP_LONG_NAME was not running." + else kill -3 $pid @@ -617,40 +534,6 @@ dump() { 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') @@ -684,16 +567,6 @@ case "$1" in dump ;; - 'start_msg') - checkUser "" $1 - startmsg - ;; - - 'stop_msg') - checkUser "" $1 - stopmsg - ;; - *) echo "Usage: $0 { console | start | stop | restart | status | dump }" exit 1 diff --git a/sonar-application/src/main/assembly/bin/windows-x86-32/InstallNTService.bat b/sonar-application/src/main/assembly/bin/windows-x86-32/InstallNTService.bat index 0fafd9762a8..1285156c340 100755 --- a/sonar-application/src/main/assembly/bin/windows-x86-32/InstallNTService.bat +++ b/sonar-application/src/main/assembly/bin/windows-x86-32/InstallNTService.bat @@ -1,59 +1,50 @@ -@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
-
-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 +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 + diff --git a/sonar-application/src/main/assembly/bin/windows-x86-32/StartNTService.bat b/sonar-application/src/main/assembly/bin/windows-x86-32/StartNTService.bat index 2899cf12c10..a8bc27a062f 100755 --- a/sonar-application/src/main/assembly/bin/windows-x86-32/StartNTService.bat +++ b/sonar-application/src/main/assembly/bin/windows-x86-32/StartNTService.bat @@ -1,59 +1,50 @@ -@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
-
-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 +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 + diff --git a/sonar-application/src/main/assembly/bin/windows-x86-32/StartSonar.bat b/sonar-application/src/main/assembly/bin/windows-x86-32/StartSonar.bat index cf3ee969c9a..8a5c96f1dd7 100755 --- a/sonar-application/src/main/assembly/bin/windows-x86-32/StartSonar.bat +++ b/sonar-application/src/main/assembly/bin/windows-x86-32/StartSonar.bat @@ -1,64 +1,55 @@ -@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 startup script.
-rem Optimized for use with version 3.3.0 of the Wrapper.
-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 +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 + diff --git a/sonar-application/src/main/assembly/bin/windows-x86-32/StopNTService.bat b/sonar-application/src/main/assembly/bin/windows-x86-32/StopNTService.bat index 7899a150c6d..bf4b3ef4d38 100755 --- a/sonar-application/src/main/assembly/bin/windows-x86-32/StopNTService.bat +++ b/sonar-application/src/main/assembly/bin/windows-x86-32/StopNTService.bat @@ -1,59 +1,50 @@ -@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
-
-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 +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 + diff --git a/sonar-application/src/main/assembly/bin/windows-x86-32/UninstallNTService.bat b/sonar-application/src/main/assembly/bin/windows-x86-32/UninstallNTService.bat index e4d82763e98..fd872824e96 100755 --- a/sonar-application/src/main/assembly/bin/windows-x86-32/UninstallNTService.bat +++ b/sonar-application/src/main/assembly/bin/windows-x86-32/UninstallNTService.bat @@ -1,59 +1,50 @@ -@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
-
-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, 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 + diff --git a/sonar-application/src/main/assembly/bin/windows-x86-32/wrapper.exe b/sonar-application/src/main/assembly/bin/windows-x86-32/wrapper.exe Binary files differnew file mode 100644 index 00000000000..b4cfc557c06 --- /dev/null +++ b/sonar-application/src/main/assembly/bin/windows-x86-32/wrapper.exe diff --git a/sonar-application/src/main/assembly/bin/windows-x86-64/InstallNTService.bat b/sonar-application/src/main/assembly/bin/windows-x86-64/InstallNTService.bat index 6bf9897ccfa..1285156c340 100755 --- a/sonar-application/src/main/assembly/bin/windows-x86-64/InstallNTService.bat +++ b/sonar-application/src/main/assembly/bin/windows-x86-64/InstallNTService.bat @@ -1,18 +1,9 @@ @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 diff --git a/sonar-application/src/main/assembly/bin/windows-x86-64/StartNTService.bat b/sonar-application/src/main/assembly/bin/windows-x86-64/StartNTService.bat index ae6a1c20a85..a8bc27a062f 100755 --- a/sonar-application/src/main/assembly/bin/windows-x86-64/StartNTService.bat +++ b/sonar-application/src/main/assembly/bin/windows-x86-64/StartNTService.bat @@ -1,18 +1,9 @@ @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 diff --git a/sonar-application/src/main/assembly/bin/windows-x86-64/StartSonar.bat b/sonar-application/src/main/assembly/bin/windows-x86-64/StartSonar.bat index 41da6f1c25b..8a5c96f1dd7 100755 --- a/sonar-application/src/main/assembly/bin/windows-x86-64/StartSonar.bat +++ b/sonar-application/src/main/assembly/bin/windows-x86-64/StartSonar.bat @@ -1,18 +1,9 @@ @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 diff --git a/sonar-application/src/main/assembly/bin/windows-x86-64/StopNTService.bat b/sonar-application/src/main/assembly/bin/windows-x86-64/StopNTService.bat index 4028d0746f4..bf4b3ef4d38 100755 --- a/sonar-application/src/main/assembly/bin/windows-x86-64/StopNTService.bat +++ b/sonar-application/src/main/assembly/bin/windows-x86-64/StopNTService.bat @@ -1,18 +1,9 @@ @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 diff --git a/sonar-application/src/main/assembly/bin/windows-x86-64/UninstallNTService.bat b/sonar-application/src/main/assembly/bin/windows-x86-64/UninstallNTService.bat index 43be50717cd..fd872824e96 100755 --- a/sonar-application/src/main/assembly/bin/windows-x86-64/UninstallNTService.bat +++ b/sonar-application/src/main/assembly/bin/windows-x86-64/UninstallNTService.bat @@ -1,18 +1,9 @@ @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 diff --git a/sonar-application/src/main/assembly/bin/windows-x86-64/wrapper.exe b/sonar-application/src/main/assembly/bin/windows-x86-64/wrapper.exe Binary files differnew file mode 100644 index 00000000000..db2dddae8c4 --- /dev/null +++ b/sonar-application/src/main/assembly/bin/windows-x86-64/wrapper.exe |