From 15d89ae5e15b7ccf47bfd67927a5afc25f2d7966 Mon Sep 17 00:00:00 2001 From: Anthony Mineo Date: Sun, 15 Mar 2020 14:47:48 -0400 Subject: [PATCH] Use cron to the keep the container alive --- app/t2-stat-parser/parser-daemon.sh | 4 ++-- app/t2-stat-parser/start.sh | 1 + build/go-t2-stat-parser/Dockerfile | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/t2-stat-parser/parser-daemon.sh b/app/t2-stat-parser/parser-daemon.sh index 8ae559f..7513e6f 100755 --- a/app/t2-stat-parser/parser-daemon.sh +++ b/app/t2-stat-parser/parser-daemon.sh @@ -5,5 +5,5 @@ echo "T2 Stat Parser Running..."; # Run this initially, then we'll execute this on a schedule ./start.sh -# Keep container running -tail -f /dev/null \ No newline at end of file +# Keep container running with the cron schedule +crond -l 2 -f \ No newline at end of file diff --git a/app/t2-stat-parser/start.sh b/app/t2-stat-parser/start.sh index aca412e..e0ad75d 100755 --- a/app/t2-stat-parser/start.sh +++ b/app/t2-stat-parser/start.sh @@ -7,5 +7,6 @@ then /app/main else echo "No build found, running from source" + cd /app go run *.go fi diff --git a/build/go-t2-stat-parser/Dockerfile b/build/go-t2-stat-parser/Dockerfile index f9565fc..6b442d4 100644 --- a/build/go-t2-stat-parser/Dockerfile +++ b/build/go-t2-stat-parser/Dockerfile @@ -30,7 +30,7 @@ RUN apk update && apk add --no-cache wget tzdata ENV TZ=America/New_York #Set cron schedule (every day at 9:30am est) -RUN crontab -l -u root | echo "30 9 * * * sh -c \"/app/start.sh\"" | crontab -u root - +RUN echo '30 9 * * * /app/start.sh' > /etc/crontabs/root WORKDIR /app