Commit bb68d7fdb3a8b9655ff4d6200f629dcf68b9df2e

Authored by George Vlahavas
1 parent 942cf4e448

Dump all container logs on fail

Showing 1 changed file with 10 additions and 0 deletions

1 1 #!/bin/sh
2 2  
  3 +dump_logs() {
  4 + CONTAINERS="suricata elasticsearch logstash kibana webserver composer_api od mltd mqtt timescaledb grafana"
  5 + for CONTAINER in $CONTAINERS; do
  6 + echo "*** Logs for kea_$CONTAINER ***"
  7 + docker logs kea_$CONTAINER
  8 + done
  9 +}
  10 +
3 11 # Login into the CUREX registry
4 12 docker login https://registry.curex-project.eu:443/artifactory/curex-local/
5 13  
... ... @@ -34,6 +42,7 @@
34 42 if [ $res -gt 0 ]; then
35 43 echo "ERROR: Some containers have exited."
36 44 docker ps -a | grep "/curex-local/kea_"
  45 + dump_logs
37 46 exit 1
38 47 fi
39 48 # count containers that are up
... ... @@ -50,6 +59,7 @@
50 59 TIME_NOW=`date +%s`
51 60 if [ $((TIME_NOW - TIME_START)) -ge 600 ]; then
52 61 echo "ERROR: Timeout exceeded."
  62 + dump_logs
53 63 exit 2
54 64 fi
55 65 sleep 1