https://issues.apache.org/bugzilla/show_bug.cgi?id=55994

            Bug ID: 55994
           Summary: enhancement for jmeter.sh startup script
           Product: JMeter
           Version: 2.10
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Main
          Assignee: [email protected]
          Reporter: [email protected]

Created attachment 31199
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=31199&action=edit
enhanced jmeter.sh

Hi guys,

The bin/jmeter.sh script will fail to launch if it is called via symlink or
called from outside of bin.

Adding the following snippet of script will resolve the true path, cd to it,
and then start jmeter.  I've attached full script with the enhancements.

-------------

#! /bin/sh
## ...

# add the following starting line 32
# resolve the true full path (e.g. called from outside of bin, called via
symlinks, and etc.)
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a
symlink
  DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
  SOURCE="$(readlink "$SOURCE")"
  [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative
symlink, we need to resolve it relative to the path where the symlink file was
located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

echo "start jmeter.sh from $DIR"
cd "$DIR"

# the rest of jmeter.sh
...

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to