mirror of
https://github.com/jetty/jetty.project.git
synced 2025-03-01 03:19:13 +00:00
475483 - Starting Jetty with [exec] should use properties file.
Added --exec-properties to allow the name of the properties file to be set and for it not to be deleted on exit.
This commit is contained in:
parent
bfeb7f56a6
commit
aca2aa56ad
@ -179,6 +179,7 @@ public class StartArgs
|
||||
private boolean dryRun = false;
|
||||
|
||||
private boolean exec = false;
|
||||
private String exec_properties;
|
||||
private boolean approveAllLicenses = false;
|
||||
|
||||
public StartArgs()
|
||||
@ -582,15 +583,22 @@ public class StartArgs
|
||||
ensureSystemPropertySet("STOP.WAIT");
|
||||
|
||||
// pass properties as args or as a file
|
||||
if (dryRun)
|
||||
if (dryRun && exec_properties==null)
|
||||
{
|
||||
for (Prop p : properties)
|
||||
cmd.addRawArg(CommandLineBuilder.quote(p.key) + "=" + CommandLineBuilder.quote(p.value));
|
||||
}
|
||||
else if (properties.size() > 0)
|
||||
{
|
||||
Path prop_path = Files.createTempFile(Paths.get(baseHome.getBase()), "start_", ".properties");
|
||||
prop_path.toFile().deleteOnExit();
|
||||
Path prop_path;
|
||||
if (exec_properties==null)
|
||||
{
|
||||
prop_path=Files.createTempFile(Paths.get(baseHome.getBase()), "start_", ".properties");
|
||||
prop_path.toFile().deleteOnExit();
|
||||
}
|
||||
else
|
||||
prop_path=new File(exec_properties).toPath();
|
||||
|
||||
try (OutputStream out = Files.newOutputStream(prop_path))
|
||||
{
|
||||
properties.store(out,"start.jar properties");
|
||||
@ -897,6 +905,15 @@ public class StartArgs
|
||||
exec = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// Assign a fixed name to the property file for exec
|
||||
if (arg.startsWith("--exec-properties="))
|
||||
{
|
||||
exec_properties=Props.getValue(arg);
|
||||
if (!exec_properties.endsWith(".properties"))
|
||||
throw new UsageException(ERR_BAD_ARG,"--exec-properties filename must have .properties suffix: %s",exec_properties);
|
||||
return;
|
||||
}
|
||||
|
||||
// Enable forked execution of Jetty server
|
||||
if ("--approve-all-licenses".equals(arg))
|
||||
|
@ -34,7 +34,12 @@ Command Line Options:
|
||||
a sub process. This can be used when start.ini
|
||||
contains -X or -D arguments, but creates an extra
|
||||
JVM instance.
|
||||
|
||||
|
||||
--exec-properties=<filename>
|
||||
Assign a fixed name to the file used to transfer
|
||||
properties to the sub process. This allows the
|
||||
generated properties file to be saved and reused.
|
||||
Without this option, a temporary file is used.
|
||||
|
||||
Debug and Start Logging:
|
||||
------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user