Save streamdata on stop

This commit is contained in:
Alexandre
2024-05-01 15:51:38 +02:00
committed by GitHub
parent f894721bf3
commit 77900d6918

View File

@@ -1,14 +1,17 @@
#!/usr/bin/bashio #!/usr/bin/bashio
bashio::log.fatal "Container stopping, saving temporary files"
# Stop the services in parallel if [ -d /tmp/StreamData ]; then
systemctl stop bridnet_analysis & bashio::log.fatal "Container stopping, saving temporary files"
systemctl stop bridnet_recording
wait 1
# Check if there are files in /tmp/StreamData and move them to /data/StreamData # Stop the services in parallel
if [ "$(ls -A /tmp/StreamData)" ]; then systemctl stop bridnet_analysis &
systemctl stop bridnet_recording
wait 1
# Check if there are files in /tmp/StreamData and move them to /data/StreamData
if [ "$(ls -A /tmp/StreamData)" ]; then
cp -rnf /tmp/StreamData/* /data/StreamData/ cp -rnf /tmp/StreamData/* /data/StreamData/
fi fi
bashio::log.fatal "... files safe, allowing container to stop" bashio::log.fatal "... files safe, allowing container to stop"
fi