fix: Send data handler output to container logs
All checks were successful
Build (and tag) Images / Build data_handler Image (push) Successful in 39s
Build (and tag) Images / Build web Image (push) Successful in 55s

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Copilot 2026-11-15 14:28:07 +01:00
commit 5ce403cec2
Signed by: ViMaSter
GPG key ID: 6D787326BA7D6469
4 changed files with 18 additions and 5 deletions

View file

@ -5,4 +5,4 @@ COPY ./data_init/*.sql /opt/init/init.sql
ENTRYPOINT ["/opt/entrypoint.sh"] ENTRYPOINT ["/opt/entrypoint.sh"]
CMD ["/bin/sh", "-c", "/usr/sbin/dcrond -f -d 5 > /var/log/dcrond.log 2>&1"] CMD ["/usr/sbin/dcrond", "-f", "-d", "5"]

View file

@ -1,6 +1,7 @@
#!/bin/sh #!/bin/sh
set -e set -e
printf 'ok\n' > /run/update_camera.status
#################################################################################################### ####################################################################################################
### Crontab settings ### Crontab settings
@ -8,7 +9,7 @@ set -e
cat<<EOF | dcrontab - cat<<EOF | dcrontab -
# min hour day month weekday command # min hour day month weekday command
*/15 * * * * sh /opt/update_camera.sh >> /var/log/update_camera_$(date +\%Y\%m\%d\%H\%M\%S).log 2>&1 */15 * * * * sh /opt/run_update_camera.sh
EOF EOF
#################################################################################################### ####################################################################################################
@ -24,7 +25,7 @@ echo "Prescripts done"
#################################################################################################### ####################################################################################################
echo "Running update once initially..." echo "Running update once initially..."
sh /opt/update_camera.sh >> /var/log/update_camera_$(date +\%Y\%m\%d\%H\%M\%S).log 2>&1 sh /opt/run_update_camera.sh
echo "Initial update done" echo "Initial update done"
#################################################################################################### ####################################################################################################

View file

@ -0,0 +1,12 @@
#!/bin/sh
status_file=/run/update_camera.status
status_file_tmp="${status_file}.$$"
if sh /opt/update_camera.sh 2>&1 | tee /proc/1/fd/1 | grep -i error >/dev/null; then
printf 'error\n' > "$status_file_tmp"
else
printf 'ok\n' > "$status_file_tmp"
fi
mv "$status_file_tmp" "$status_file"

View file

@ -58,9 +58,9 @@ services:
db: db:
condition: service_healthy condition: service_healthy
restart: true restart: true
# if the latest `update_camera_*.log` contains "error", fail the healthcheck # if the latest update output contains "error", fail the healthcheck
healthcheck: healthcheck:
test: ["CMD", "sh", "-c", "ls /var/log | grep '^update_camera_' | xargs -I {} sh -c 'grep -q error /var/log/{} || exit 0; exit 1'"] test: ["CMD", "sh", "-c", "test \"$(cat /run/update_camera.status)\" = ok"]
interval: 10s interval: 10s
timeout: 5s timeout: 5s
start_period: 30s start_period: 30s