Merge branch '1.5.x'

pull/12022/merge
Andy Wilkinson 7 years ago
commit e1ab62668f

@ -156,7 +156,15 @@ do_start() {
pushd "$working_dir" > /dev/null
if [[ ! -e "$PID_FOLDER" ]]; then
mkdir -p "$PID_FOLDER" &> /dev/null
chown "$run_user" "$PID_FOLDER"
if [[ -n "$run_user" ]]; then
chown "$run_user" "$PID_FOLDER"
fi
fi
if [[ ! -e "$log_file" ]]; then
touch "$log_file" &> /dev/null
if [[ -n "$run_user" ]]; then
chown "$run_user" "$log_file"
fi
fi
if [[ -n "$run_user" ]]; then
checkPermissions || return $?

@ -229,7 +229,6 @@ public class SysVinitLaunchScriptIT {
@Test
public void pidFolderOwnership() throws Exception {
String output = doTest("pid-folder-ownership.sh");
System.err.println(output);
assertThat(output).contains("phil root");
}
@ -245,6 +244,18 @@ public class SysVinitLaunchScriptIT {
assertThat(output).contains("phil root");
}
@Test
public void logFileOwnershipIsChangedWhenCreated() throws Exception {
String output = doTest("log-file-ownership-is-changed-when-created.sh");
assertThat(output).contains("andy root");
}
@Test
public void logFileOwnershipIsUnchangedWhenExists() throws Exception {
String output = doTest("log-file-ownership-is-unchanged-when-exists.sh");
assertThat(output).contains("root root");
}
@Test
public void launchWithRelativeLogFolder() throws Exception {
String output = doTest("launch-with-relative-log-folder.sh");

@ -0,0 +1,9 @@
source ./test-functions.sh
install_service
echo 'LOG_FOLDER=log' > /test-service/spring-boot-app.conf
mkdir -p /test-service/log
useradd andy
chown andy /test-service/spring-boot-app.jar
start_service
await_app
ls -al /test-service/log/spring-boot-app.log

@ -0,0 +1,11 @@
source ./test-functions.sh
install_service
echo 'LOG_FOLDER=log' > /test-service/spring-boot-app.conf
mkdir -p /test-service/log
touch /test-service/log/spring-boot-app.log
chmod a+w /test-service/log/spring-boot-app.log
useradd andy
chown andy /test-service/spring-boot-app.jar
start_service
await_app
ls -al /test-service/log/spring-boot-app.log
Loading…
Cancel
Save