diff --git a/jetty-runner/src/main/java/org/eclipse/jetty/runner/Runner.java b/jetty-runner/src/main/java/org/eclipse/jetty/runner/Runner.java index 14122a80809..dfd78d1d241 100644 --- a/jetty-runner/src/main/java/org/eclipse/jetty/runner/Runner.java +++ b/jetty-runner/src/main/java/org/eclipse/jetty/runner/Runner.java @@ -166,8 +166,8 @@ public class Runner System.err.println(" --out file - info/warn/debug log filename (with optional 'yyyy_mm_dd' wildcard"); System.err.println(" --host name|ip - interface to listen on (default is all interfaces)"); System.err.println(" --port n - port to listen on (default 8080)"); - System.err.println(" --stop-port n - port to listen for stop command"); - System.err.println(" --stop-key n - security string for stop command (required if --stop-port is present)"); + System.err.println(" --stop-port n - port to listen for stop command (or -DSTOP.PORT)"); + System.err.println(" --stop-key n - security string for stop command (required if --stop-port is present) (or -DSTOP.KEY)"); System.err.println(" [--jar file]*n - each tuple specifies an extra jar to be added to the classloader"); System.err.println(" [--lib dir]*n - each tuple specifies an extra directory of jars to be added to the classloader"); System.err.println(" [--classes dir]*n - each tuple specifies an extra directory of classes to be added to the classloader"); @@ -239,8 +239,8 @@ public class Runner boolean contextPathSet = false; int port = __defaultPort; String host = null; - int stopPort = 0; - String stopKey = null; + int stopPort = Integer.getInteger( "STOP.PORT", 0 ); + String stopKey = System.getProperty("STOP.KEY", null); boolean runnerServerInitialized = false; @@ -297,6 +297,18 @@ public class Runner _statsPropFile = ("unsecure".equalsIgnoreCase(_statsPropFile) ? null : _statsPropFile); break; default: + // process system property type argument so users can use in second args part + if ( args[i].startsWith( "-D" ) ){ + String[] sysProps = args[i].substring(2).split("=",2); + if("STOP.KEY".equals( sysProps[0] )){ + stopKey = sysProps[1]; + break; + } else if("STOP.PORT".equals( sysProps[0] )){ + stopPort = Integer.valueOf(sysProps[1]); + break; + } + } + // process contexts if (!runnerServerInitialized) // log handlers not registered, server maybe not created, etc diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/ShutdownMonitor.java b/jetty-server/src/main/java/org/eclipse/jetty/server/ShutdownMonitor.java index e8ad45dfac3..6e09c02e08f 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/ShutdownMonitor.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/ShutdownMonitor.java @@ -45,7 +45,7 @@ import org.eclipse.jetty.util.thread.ShutdownThread; * This thread listens on the host/port specified by the STOP.HOST/STOP.PORT * system parameter (defaults to 127.0.0.1/-1 for not listening) for request * authenticated with the key given by the STOP.KEY system parameter - * (defaults to "eclipse") for admin requests. + * for admin requests. *

* If the stop port is set to zero, then a random port is assigned and the * port number is printed to stdout. @@ -97,7 +97,7 @@ public class ShutdownMonitor * Creates a ShutdownMonitor using configuration from the System properties. *

* STOP.PORT = the port to listen on (empty, null, or values less than 0 disable the stop ability)
- * STOP.KEY = the magic key/passphrase to allow the stop (defaults to "eclipse")
+ * STOP.KEY = the magic key/passphrase to allow the stop
*

* Note: server socket will only listen on localhost, and a successful stop will issue a System.exit() call. */ @@ -105,7 +105,7 @@ public class ShutdownMonitor { this.debug = System.getProperty("DEBUG") != null; this.host = System.getProperty("STOP.HOST", "127.0.0.1"); - this.port = Integer.parseInt(System.getProperty("STOP.PORT", "-1")); + this.port = Integer.getInteger("STOP.PORT", -1); this.key = System.getProperty("STOP.KEY", null); this.exitVm = true; }