mirror of https://github.com/OpenVidu/openvidu.git
openvidu-server: update file permissions when stopping composed audio-only recs
parent
16019da939
commit
b25a029c5d
|
@ -365,6 +365,8 @@ public class ComposedRecordingService extends RecordingService {
|
||||||
long finalSize = videoFile.length();
|
long finalSize = videoFile.length();
|
||||||
long finalDuration = compositeWrapper.getDuration();
|
long finalDuration = compositeWrapper.getDuration();
|
||||||
|
|
||||||
|
this.updateFilePermissions(filesPath);
|
||||||
|
|
||||||
this.sealRecordingMetadataFile(recording, finalSize, finalDuration,
|
this.sealRecordingMetadataFile(recording, finalSize, finalDuration,
|
||||||
filesPath + RecordingManager.RECORDING_ENTITY_FILE + recording.getId());
|
filesPath + RecordingManager.RECORDING_ENTITY_FILE + recording.getId());
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
|
|
||||||
package io.openvidu.server.recording.service;
|
package io.openvidu.server.recording.service;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -27,6 +29,7 @@ import io.openvidu.java.client.RecordingProperties;
|
||||||
import io.openvidu.server.config.OpenviduConfig;
|
import io.openvidu.server.config.OpenviduConfig;
|
||||||
import io.openvidu.server.core.Session;
|
import io.openvidu.server.core.Session;
|
||||||
import io.openvidu.server.recording.Recording;
|
import io.openvidu.server.recording.Recording;
|
||||||
|
import io.openvidu.server.utils.CommandExecutor;
|
||||||
import io.openvidu.server.utils.CustomFileWriter;
|
import io.openvidu.server.utils.CustomFileWriter;
|
||||||
|
|
||||||
public abstract class RecordingService {
|
public abstract class RecordingService {
|
||||||
|
@ -126,6 +129,20 @@ public abstract class RecordingService {
|
||||||
return new PropertiesRecordingId(properties, recordingId);
|
return new PropertiesRecordingId(properties, recordingId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void updateFilePermissions(String folder) {
|
||||||
|
String command = "chmod -R 777 " + folder;
|
||||||
|
try {
|
||||||
|
String response = CommandExecutor.execCommand("/bin/sh", "-c", command);
|
||||||
|
if ("".equals(response)) {
|
||||||
|
log.info("Individual recording file permissions successfully updated");
|
||||||
|
} else {
|
||||||
|
log.error("Individual recording file permissions failed to update: {}", response);
|
||||||
|
}
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
|
log.error("Individual recording file permissions failed to update. Error: {}", e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected String getShortSessionId(Session session) {
|
protected String getShortSessionId(Session session) {
|
||||||
return session.getSessionId().substring(session.getSessionId().lastIndexOf('/') + 1,
|
return session.getSessionId().substring(session.getSessionId().lastIndexOf('/') + 1,
|
||||||
session.getSessionId().length());
|
session.getSessionId().length());
|
||||||
|
|
|
@ -448,18 +448,4 @@ public class SingleStreamRecordingService extends RecordingService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateFilePermissions(String folder) {
|
|
||||||
String command = "chmod -R 777 " + folder;
|
|
||||||
try {
|
|
||||||
String response = CommandExecutor.execCommand("/bin/sh", "-c", command);
|
|
||||||
if ("".equals(response)) {
|
|
||||||
log.info("Individual recording file permissions successfully updated");
|
|
||||||
} else {
|
|
||||||
log.error("Individual recording file permissions failed to update: {}", response);
|
|
||||||
}
|
|
||||||
} catch (IOException | InterruptedException e) {
|
|
||||||
log.error("Individual recording file permissions failed to update. Error: {}", e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue