diff --git a/spring-boot-docs/src/main/asciidoc/deployment.adoc b/spring-boot-docs/src/main/asciidoc/deployment.adoc index 329f36c19f..bdbd61b9fb 100644 --- a/spring-boot-docs/src/main/asciidoc/deployment.adoc +++ b/spring-boot-docs/src/main/asciidoc/deployment.adoc @@ -629,6 +629,12 @@ for Gradle and to `${project.name}` for Maven. |`initInfoChkconfig` |The `chkconfig` section of "`INIT INFO`". Defaults to `2345 99 01`. +|`logFolder` +|The default value for `LOG_FOLDER`. Only valid for an `init.d` service. + +|`pidFolder` +|The default value for `PID_FOLDER`. Only valid for an `init.d` service. + |`useStartStopDaemon` |If the `start-stop-daemon` command, when it's available, should be used to control the process. Defaults to `true`. diff --git a/spring-boot-tools/spring-boot-loader-tools/src/main/resources/org/springframework/boot/loader/tools/launch.script b/spring-boot-tools/spring-boot-loader-tools/src/main/resources/org/springframework/boot/loader/tools/launch.script index 11f55304b4..25fd71bf3a 100755 --- a/spring-boot-tools/spring-boot-loader-tools/src/main/resources/org/springframework/boot/loader/tools/launch.script +++ b/spring-boot-tools/spring-boot-loader-tools/src/main/resources/org/springframework/boot/loader/tools/launch.script @@ -46,8 +46,8 @@ configfile="$(basename "${jarfile%.*}.conf")" [[ -r "${jarfolder}/${configfile}" ]] && source "${jarfolder}/${configfile}" # Initialize PID/LOG locations if they weren't provided by the config file -[[ -z "$PID_FOLDER" ]] && PID_FOLDER="/var/run" -[[ -z "$LOG_FOLDER" ]] && LOG_FOLDER="/var/log" +[[ -z "$PID_FOLDER" ]] && PID_FOLDER="{{pidFolder:/var/run}}" +[[ -z "$LOG_FOLDER" ]] && LOG_FOLDER="{{logFolder:/var/log}}" ! [[ -x "$PID_FOLDER" ]] && PID_FOLDER="/tmp" ! [[ -x "$LOG_FOLDER" ]] && LOG_FOLDER="/tmp" diff --git a/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/DefaultLaunchScriptTests.java b/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/DefaultLaunchScriptTests.java index 71c54eef50..6b22030c81 100644 --- a/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/DefaultLaunchScriptTests.java +++ b/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/DefaultLaunchScriptTests.java @@ -76,6 +76,16 @@ public class DefaultLaunchScriptTests { assertThatPlaceholderCanBeReplaced("useStartStopDaemon"); } + @Test + public void logFolderCanBeReplaced() throws Exception { + assertThatPlaceholderCanBeReplaced("logFolder"); + } + + @Test + public void pidFolderCanBeReplaced() throws Exception { + assertThatPlaceholderCanBeReplaced("pidFolder"); + } + @Test public void defaultForUseStartStopDaemonIsTrue() throws Exception { DefaultLaunchScript script = new DefaultLaunchScript(null, null);