[java-idp-plugin-jetty] branch main updated: JJETTY-33 - Improve runjetty script with parameters for different modes

Codeberg noreply at shibboleth.net
Mon Nov 17 15:07:53 UTC 2025


This is an automated email from the git hooks/post-receive script.

codeberg pushed a commit to branch main
in repository java-idp-plugin-jetty.

View the commit online:
https://codeberg.org/Shibboleth/java-idp-plugin-jetty/commit/03197838659b0125b4a2e017ff649f1f80e8179e

The following commit(s) were added to refs/heads/main by this push:
     new 0319783  JJETTY-33 - Improve runjetty script with parameters for different modes
0319783 is described below

commit 03197838659b0125b4a2e017ff649f1f80e8179e
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon Nov 17 10:07:43 2025 -0500

    JJETTY-33 - Improve runjetty script with parameters for different modes
    
    https://shibboleth.atlassian.net/browse/JJETTY-33
    
    Ported over some of my init script behaviors.
    Default is now back to foregounding, but start will background it.
    Added status, stop, restart.
---
 .../net/shibboleth/idp/module/jetty/runjetty.sh    | 93 +++++++++++++++++++++-
 1 file changed, 90 insertions(+), 3 deletions(-)

diff --git a/jetty-impl/src/main/resources/net/shibboleth/idp/module/jetty/runjetty.sh b/jetty-impl/src/main/resources/net/shibboleth/idp/module/jetty/runjetty.sh
index 9706f3a..eb5d0db 100644
--- a/jetty-impl/src/main/resources/net/shibboleth/idp/module/jetty/runjetty.sh
+++ b/jetty-impl/src/main/resources/net/shibboleth/idp/module/jetty/runjetty.sh
@@ -17,7 +17,7 @@ if [ -e $LOCATION/jettyenv.sh ] ; then
   source $LOCATION/jettyenv.sh
 fi
 
-if [ -z "$JAVACMD" ] ; then 
+if [ -z "$JAVACMD" ] ; then
   if [ -n "$JAVA_HOME"  ] ; then
     JAVACMD=$JAVA_HOME/bin/java
   else
@@ -53,9 +53,96 @@ if [ ! -e "$JETTY_TMP" ] ; then
   mkdir "$JETTY_TMP"
 fi
 
-
 JVM_ARGS="-Didp.home=$IDP_HOME -Djava.io.tmpdir=$JETTY_TMP -XX:+UseG1GC"
 
 JETTY_ARGS="jetty.base=$JETTY_BASE jetty.logging.dir=$IDP_HOME/logs --exec"
 
-$JAVACMD $JAVA_OPTS '-jar' $JETTY_HOME/start.jar $JVM_ARGS $JETTY_ARGS "$@" &
+success() {
+    [ "$BOOTUP" = "color" ] && $MOVE_TO_COL
+    echo -n "["
+    [ "$BOOTUP" = "color" ] && $SETCOLOR_SUCCESS
+    echo -n $"  OK  "
+    [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
+    echo -n "]"
+    echo -ne "\r"
+    return 0
+}
+
+failure() {
+    [ "$BOOTUP" = "color" ] && $MOVE_TO_COL
+    echo -n "["
+    [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
+    echo -n $"FAILED"
+    [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
+    echo -n "]"
+    echo -ne "\r"
+    return 1
+}
+
+getpid() {
+    ps ax -w -w | grep "$JETTY_HOME" | grep "\-\-exec" | awk '{printf $1 " "}'
+}
+
+run() {
+    $JAVACMD $JAVA_OPTS '-jar' $JETTY_HOME/start.jar $JVM_ARGS $JETTY_ARGS "$@"
+}
+
+start() {
+    $JAVACMD $JAVA_OPTS '-jar' $JETTY_HOME/start.jar $JVM_ARGS $JETTY_ARGS "$@" &
+
+    PID=`getpid`
+    if [ -z "$PID" ] ; then
+        failure
+    else
+        success
+    fi
+    echo
+}
+
+stop() {
+    echo -n $"Shutting down Jetty: "
+    PID=`getpid`
+    if [ -z "$PID" ] ; then
+        failure
+    else
+        kill $PID && success || failure
+    fi
+    echo
+}
+
+status() {
+    getpid | wc | awk '{print $2}' > /tmp/jetty_process_count.txt
+    read line < /tmp/jetty_process_count.txt
+    if [ $line -gt 0 ]; then
+        echo -n "Jetty ( pid "
+        ps ax -w -w | grep "$JETTY_HOME" | grep "\-\-exec" | awk '{printf $1 " "}'
+        echo -n ") is running..."
+        echo
+    else
+        echo "Jetty is stopped"
+    fi
+}
+
+case "$1" in
+    run)
+        run
+        ;;
+    start)
+        start
+        ;;
+    stop)
+        stop
+        ;;
+    restart)
+        stop
+        sleep 3
+        start
+        ;;
+    status)
+        status
+        ;;
+    *)
+        run
+        exit 0
+esac
+

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list