Skip to content

Commit

Permalink
Separate -D parameters from other parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
ar committed Jul 13, 2024
1 parent cadf90f commit 3d40519
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions jpos/src/dist/bin/q2
Original file line number Diff line number Diff line change
@@ -1,19 +1,33 @@
#!/bin/sh

cd $(dirname $0)/.. || exit 1
cd "$(dirname "$0")/.." || exit 1
rm -f deploy/shutdown.xml

if [ -f jpos.pid ] && ps -p $(cat jpos.pid) > /dev/null 2>&1
if [ -f jpos.pid ] && ps -p "$(cat jpos.pid)" > /dev/null 2>&1
then
echo "Process $(cat jpos.pid) is running"
else
rm -f jpos.pid

# Separate -D parameters from other parameters
JAVA_OPTS=""
OTHER_OPTS=""
for arg in "$@"; do
case $arg in
-D*)
JAVA_OPTS="$JAVA_OPTS $arg"
;;
*)
OTHER_OPTS="$OTHER_OPTS $arg"
;;
esac
done

mkdir -p log
exec java -server \
-Xmx4G \
--enable-preview \
-Xlog:gc:log/gc.log \
-jar @jarname@ --pid="jpos.pid" "$@"
$JAVA_OPTS -jar @jarname@ --pid="jpos.pid" $OTHER_OPTS
fi

# -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005 \
# --show-module-resolution \

0 comments on commit 3d40519

Please sign in to comment.