Set the working directory to that of the jar when using start-stop-daemon

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
This commit is contained in:
Andy Wilkinson
2015-10-30 15:09:41 +00:00
parent 9a7baf195e
commit 826acf5d67

View File

@@ -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 "$@" \