From 826acf5d67cfa789cdd301dbea222201f868c395 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Fri, 30 Oct 2015 15:09:41 +0000 Subject: [PATCH] Set the working directory to that of the jar when using start-stop-daemon MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit By default, start-stop-daemon will chdir to the root directory before starting the process. This prevents an application.properties file that sits alongside the jar from being found. This commit updates the call to start-stop-daemon to use --chdir to set the working directory to that of the jar that’s being launched. Closes gh-4281 --- .../org/springframework/boot/loader/tools/launch.script | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 9171f318e9..fe92724424 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 @@ -122,7 +122,8 @@ start() { } do_start() { - pushd $(dirname "$jarfile") > /dev/null + working_dir=$(dirname "$jarfile") + pushd "$working_dir" > /dev/null if [[ -n "$run_user" ]]; then mkdir "$PID_FOLDER" &> /dev/null checkPermissions || return $? @@ -136,6 +137,7 @@ do_start() { --make-pidfile --pidfile $pid_file \ --background --no-close \ --startas $javaexe \ + --chdir "$working_dir" -- \ -Dsun.misc.URLClassPath.disableJarChecking=true $JAVA_OPTS \ -jar $jarfile $RUN_ARGS "$@" \