diff --git a/scouter.server/scripts/env.sh b/scouter.server/scripts/env.sh new file mode 100644 index 000000000..6673fca9a --- /dev/null +++ b/scouter.server/scripts/env.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +READLINK="`dirname $0`/readlink.sh" +TUNAHOME="`dirname $($READLINK $0/..)`" + +JAVAOPTS="-Xmx512m" + diff --git a/scouter.server/scripts/readlink.sh b/scouter.server/scripts/readlink.sh new file mode 100755 index 000000000..3e31fd345 --- /dev/null +++ b/scouter.server/scripts/readlink.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +TARGET_FILE=$1 + +cd `dirname $TARGET_FILE` +TARGET_FILE=`basename $TARGET_FILE` + +# Iterate down a (possible) chain of symlinks +while [ -L "$TARGET_FILE" ] +do + TARGET_FILE=`readlink $TARGET_FILE` + cd `dirname $TARGET_FILE` + TARGET_FILE=`basename $TARGET_FILE` +done + +# Compute the canonicalized name by finding the physical path +# for the directory we're in and appending the target file. +PHYS_DIR=`pwd -P` +RESULT=$PHYS_DIR/$TARGET_FILE +echo $RESULT diff --git a/scouter.server/scripts/startcon.sh b/scouter.server/scripts/startcon.sh index f0472d5b8..7db9ccabd 100644 --- a/scouter.server/scripts/startcon.sh +++ b/scouter.server/scripts/startcon.sh @@ -1 +1,5 @@ -java -Xmx512m -classpath ./boot.jar scouter.boot.Boot ./lib -console \ No newline at end of file +#!/usr/bin/env bash + +. $(dirname $0)/env.sh + +java -Xmx512m -classpath "$TUNAHOME/boot.jar" scouter.boot.Boot "$TUNAHOME/lib" -console diff --git a/scouter.server/scripts/startup.sh b/scouter.server/scripts/startup.sh index 2fe15e5b3..0531ae98f 100644 --- a/scouter.server/scripts/startup.sh +++ b/scouter.server/scripts/startup.sh @@ -1,5 +1,10 @@ -mkdir logs > /dev/null 2>&1 -cp nohup.out ./logs/nohup.$(date '+%Y%m%d%H%M%S').out > /dev/null 2>&1 -nohup java -Xmx512m -classpath ./boot.jar scouter.boot.Boot ./lib > nohup.out & +#!/usr/bin/env bash + +. $(dirname $0)/env.sh + +mkdir -p "$TUNAHOME/logs" > /dev/null 2>&1 +cp nohup.out "$TUNAHOME/logs/nohup.$(date '+%Y%m%d%H%M%S').out" > /dev/null 2>&1 +nohup java $JAVAOPTS -classpath "$TUNAHOME/boot.jar" scouter.boot.Boot "$TUNAHOME/lib" > nohup.out & + echo "Scouter server launching..." echo "See the nohup.out." diff --git a/scouter.server/scripts/stop.sh b/scouter.server/scripts/stop.sh index 0e0cf0bab..c8fd19e9d 100644 --- a/scouter.server/scripts/stop.sh +++ b/scouter.server/scripts/stop.sh @@ -1 +1,5 @@ -rm -f *.scouter \ No newline at end of file +#!/usr/bin/env bash + +. $(dirname $0)/env.sh + +rm -f "$TUNAHOME/*.scouter"