You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by dk...@apache.org on 2021/04/30 03:57:37 UTC
[sling-org-apache-sling-app-cms] branch master updated: Minor -
fixing the start / stop scripts to work with the feature launcher
This is an automated email from the ASF dual-hosted git repository.
dklco pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-app-cms.git
The following commit(s) were added to refs/heads/master by this push:
new 93e3b8f Minor - fixing the start / stop scripts to work with the feature launcher
93e3b8f is described below
commit 93e3b8f6570c825330093becd105c1c8ef12d168
Author: Dan Klco <kl...@adobe.com>
AuthorDate: Thu Apr 29 23:57:28 2021 -0400
Minor - fixing the start / stop scripts to work with the feature launcher
---
vagrant/src/start.sh | 23 +++++++++++++----------
vagrant/src/stop.sh | 38 ++++++++++++++------------------------
2 files changed, 27 insertions(+), 34 deletions(-)
diff --git a/vagrant/src/start.sh b/vagrant/src/start.sh
index ec0d96f..6a5b3a9 100755
--- a/vagrant/src/start.sh
+++ b/vagrant/src/start.sh
@@ -21,6 +21,10 @@
# The following variables may be used to override the defaults.
#
+script="$0"
+basename="$(dirname $script)"
+cd $basename
+
# port used for accessing the app
if [ -z "$APP_PORT" ]; then
APP_PORT=8080
@@ -28,7 +32,7 @@ fi
# default JVM options
if [ -z "$APP_JVM_OPTS" ]; then
- APP_JVM_OPTS='-server -Xmx1024m -XX:MaxPermSize=256M -Djava.awt.headless=true'
+ APP_JVM_OPTS='-server -Xmx512m -XX:MaxPermSize=64M -Djava.awt.headless=true -Dorg.osgi.service.http.port=${APP_PORT}'
fi
# debugging support
@@ -40,19 +44,18 @@ fi
# do not configure below this point
# ------------------------------------------------------------------------------
-if [ $APP_PORT ]; then
- START_OPTS="${START_OPTS} -p ${APP_PORT}"
-fi
START_OPTS="${START_OPTS}"
-SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
-JARFILE=`ls ${SCRIPTPATH}/*cms*.jar | head -1`
-cd ${SCRIPTPATH}
-mkdir -p sling/logs
+JARFILE=`ls *cms*.jar | head -1`
+if [ -z "$JARFILE" ]; then
+ echo "No CMS JAR file found."
+ exit 1
+fi
+mkdir -p launcher/logs
(
(
- java $APP_JVM_OPTS -jar $JARFILE $START_OPTS &
+ java $APP_JVM_OPTS -jar $JARFILE -f *.far $START_OPTS &
echo $! > app.pid
- ) >> sling/logs/stdout.log 2>&1
+ ) >> launcher/logs/stdout.log 2>&1
) &
echo "Application started on port ${APP_PORT}!"
\ No newline at end of file
diff --git a/vagrant/src/stop.sh b/vagrant/src/stop.sh
index 9c2db1c..fd8cfd0 100755
--- a/vagrant/src/stop.sh
+++ b/vagrant/src/stop.sh
@@ -18,30 +18,20 @@
# This script stops the (running) application
#
-START_OPTS='stop -c .'
-SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
-JARFILE=`ls ${SCRIPTPATH}/*cms*.jar | head -1`
-
-java -jar $JARFILE $START_OPTS
-STOP_CODE=$?
-if [ "${STOP_CODE}" == "0" ]; then
- echo "Application not running"
+echo "Stop command returned ${STOP_CODE}. Trying to kill the process..."
+PID=$(cat app.pid 2>/dev/null)
+rm -f app.pid
+if [ "$PID" ]; then
+ if ps -p $PID > /dev/null 2>&1; then
+ kill $PID
+ STOP_CODE=$?
+ echo "process ${PID} was killed"
+ else
+ echo "process ${PID} not running"
+ STOP_CODE=4
+ fi
else
- echo "Stop command returned ${STOP_CODE}. Trying to kill the process..."
- PID=$(cat ${SCRIPTPATH}/app.pid 2>/dev/null)
- if [ "$PID" ]; then
- if ps -p $PID > /dev/null 2>&1; then
- kill $PID
- STOP_CODE=$?
- echo "process ${PID} was killed"
- else
- echo "process ${PID} not running"
- STOP_CODE=4
- fi
- else
- echo "app.pid not found"
- STOP_CODE=4
- fi
- rm -f ${SCRIPTPATH}/app.pid
+ echo "app.pid not found"
+ STOP_CODE=4
fi
exit ${STOP_CODE}
\ No newline at end of file