Skip to content

Commit

Permalink
Merge branch '1.5.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
philwebb committed Jan 30, 2018
2 parents 187c4d7 + 9b8cb9a commit 886b392
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
source ./test-functions.sh
install_service

chmod o+w /var/log

useradd phil
mkdir /phil-files
chown phil /phil-files

useradd andy
chown andy /test-service/spring-boot-app.jar

start_service
stop_service

su - andy -c "ln -s -f /phil-files /var/log/spring-boot-app.log"

start_service

ls -ld /phil-files
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
source ./test-functions.sh
install_service

useradd phil
mkdir /phil-files
chown phil /phil-files

useradd andy
chown andy /test-service/spring-boot-app.jar

start_service
stop_service

su - andy -c "ln -s /phil-files /var/run/spring-boot-app/spring-boot-app.pid"

start_service

ls -ld /phil-files
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
source ./test-functions.sh
install_service

chmod o+w /var/run

useradd phil
mkdir /phil-files
chown phil /phil-files

useradd andy
chown andy /test-service/spring-boot-app.jar

su - andy -c "ln -s -f /phil-files /var/run/spring-boot-app"

start_service

ls -ld /phil-files
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,12 @@ start() {
do_start() {
working_dir=$(dirname "$jarfile")
pushd "$working_dir" > /dev/null
mkdir -p "$PID_FOLDER" &> /dev/null
if [[ ! -e "$PID_FOLDER" ]]; then
mkdir -p "$PID_FOLDER" &> /dev/null
chown "$run_user" "$PID_FOLDER"
fi
if [[ -n "$run_user" ]]; then
checkPermissions || return $?
chown "$run_user" "$PID_FOLDER"
chown "$run_user" "$pid_file"
chown "$run_user" "$log_file"
if [ $USE_START_STOP_DAEMON = true ] && type start-stop-daemon > /dev/null 2>&1; then
start-stop-daemon --start --quiet \
--chuid "$run_user" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,25 @@ public void launchWithRelativePidFolder() throws Exception {
coloredString(AnsiColor.GREEN, "Stopped [" + extractPid(output) + "]"));
}

@Test
public void pidFolderOwnership() throws Exception {
String output = doTest("pid-folder-ownership.sh");
System.err.println(output);
assertThat(output).contains("phil root");
}

@Test
public void pidFileOwnership() throws Exception {
String output = doTest("pid-file-ownership.sh");
assertThat(output).contains("phil root");
}

@Test
public void logFileOwnership() throws Exception {
String output = doTest("log-file-ownership.sh");
assertThat(output).contains("phil root");
}

@Test
public void launchWithRelativeLogFolder() throws Exception {
String output = doTest("launch-with-relative-log-folder.sh");
Expand Down

3 comments on commit 886b392

@SelfImpr689
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Philwebb,
I am working on spring boot (1.5.2.release) + jetty project, and it running under linux, and I start App.jar with App.conf file,
and it is strange that the pid file was generated but under a strange sub directory, like /opt/a/b/app_abApp/App.pid,
I found it seems that affected by launch.script, but I set APP_NAME in App.conf, it is no useful.
Can you tell me how to solve this problem? I hope the subDirecory I can set by some way.

@wilkinsona
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SelfImpr689 A comment on a commit really isn't the right place to ask a question like this. As requested in the guidelines for contributing, please use Stack Overflow for questions such as this. Alternatively, you can chat with the Spring Boot community on Gitter.

@SelfImpr689
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wilkinsona ok, I got it. Thanks for your guide.

Please sign in to comment.