Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'jetty-start')
-rw-r--r--jetty-start/src/main/java/org/eclipse/jetty/start/Main.java27
-rw-r--r--jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt4
2 files changed, 18 insertions, 13 deletions
diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java
index e4af9bfb56..62926ea2ec 100644
--- a/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java
+++ b/jetty-start/src/main/java/org/eclipse/jetty/start/Main.java
@@ -450,6 +450,7 @@ public class Main
private void doStop(StartArgs args)
{
+ String stopHost = args.getProperties().getString("STOP.HOST");
int stopPort = Integer.parseInt(args.getProperties().getString("STOP.PORT"));
String stopKey = args.getProperties().getString("STOP.KEY");
@@ -457,41 +458,41 @@ public class Main
{
int stopWait = Integer.parseInt(args.getProperties().getString("STOP.WAIT"));
- stop(stopPort,stopKey,stopWait);
+ stop(stopHost,stopPort,stopKey,stopWait);
}
else
{
- stop(stopPort,stopKey);
+ stop(stopHost,stopPort,stopKey);
}
}
/**
* Stop a running jetty instance.
*/
- public void stop(int port, String key)
+ public void stop(String host, int port, String key)
{
- stop(port,key,0);
+ stop(host,port,key,0);
}
- public void stop(int port, String key, int timeout)
+ public void stop(String host, int port, String key, int timeout)
{
- int _port = port;
- String _key = key;
-
+ if (host==null || host.length()==0)
+ host="127.0.0.1";
+
try
{
- if (_port <= 0)
+ if (port <= 0)
{
System.err.println("STOP.PORT system property must be specified");
}
- if (_key == null)
+ if (key == null)
{
- _key = "";
+ key = "";
System.err.println("STOP.KEY system property must be specified");
System.err.println("Using empty key");
}
- try (Socket s = new Socket(InetAddress.getByName("127.0.0.1"),_port))
+ try (Socket s = new Socket(InetAddress.getByName(host),port))
{
if (timeout > 0)
{
@@ -500,7 +501,7 @@ public class Main
try (OutputStream out = s.getOutputStream())
{
- out.write((_key + "\r\nstop\r\n").getBytes());
+ out.write((key + "\r\nstop\r\n").getBytes());
out.flush();
if (timeout > 0)
diff --git a/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt b/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt
index 0817b46738..eacb16b620 100644
--- a/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt
+++ b/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt
@@ -108,6 +108,10 @@ Startup / Shutdown Command Line:
Properties:
+ STOP.HOST=[string]
+ The host to use to stop the running Jetty server (defaults to 127.0.0.1)
+ Required along with STOP.PORT if you want to use the --stop option above.
+
STOP.PORT=[number]
The port to use to stop the running Jetty server.
Required along with STOP.KEY if you want to use the --stop option above.

Back to the top