auto symlink heartbeat file

This commit is contained in:
Jonathan Shook 2024-01-11 00:40:11 -06:00
parent 7beb18730e
commit d6f679173f

View File

@ -52,6 +52,11 @@ public class ComponentPulse extends UnstartedPeriodicTaskComponent {
Heartbeat heartbeat = pulseOf.heartbeat().withHeartbeatDetails(intervalmillis,System.currentTimeMillis());
try {
Files.writeString(hbpath, heartbeat.toYaml(), StandardOpenOption.WRITE, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);
Files.deleteIfExists(linkpath);
Files.createSymbolicLink(
linkpath,
hbpath.getFileName()
);
} catch (IOException e) {
logger.error("Unable to write heartbeat data to " + hbpath.toString() + ": " + e);
}