Change ownership when log file is created by launch script
Closes gh-11951
This commit is contained in:
@@ -223,7 +223,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");
|
||||
}
|
||||
|
||||
@@ -239,6 +238,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
|
||||
Reference in New Issue
Block a user