From d6b63f0f46274302f43d5ab0991a302421ad3a25 Mon Sep 17 00:00:00 2001 From: Travis Miller Date: Wed, 31 Jan 2024 14:37:14 -0600 Subject: [PATCH] Add cron.sh for scheduled runs --- cron.sh | 21 +++++++++++++++++++++ docker-compose.yml | 1 + run.sh | 4 +++- 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100755 cron.sh diff --git a/cron.sh b/cron.sh new file mode 100755 index 0000000..6481d89 --- /dev/null +++ b/cron.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +set -e + +export PATH="$PATH:/snap/bin" + +cd /home/snipeit/heroku-bucketeer-s3-sync + +docker compose up -d + +# Delay for s3fs to establish mount +sleep 5 + +echo '---' >> logs/cron.log +date >> logs/cron.log + +#./run.sh tpsdata-production--import >> logs/cron.log 2>&1 +./run.sh tpsdata-production--import + +echo "exit: $?" >> logs/cron.log +date >> logs/cron.log diff --git a/docker-compose.yml b/docker-compose.yml index aa62a5c..7a4d4f1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,6 +4,7 @@ services: s3fs: build: . privileged: true + restart: unless-stopped volumes: - ./volumes/aws-credentials:/root/.aws/credentials - ./volumes/s3fs-authfile:/root/.s3fs diff --git a/run.sh b/run.sh index aee150f..8761a25 100755 --- a/run.sh +++ b/run.sh @@ -29,7 +29,9 @@ function seconds_format() { } function sync() { - docker compose run -i --rm s3fs aws s3 sync /mnt/ "s3://$BUCKET_PATH/" --no-progress + docker compose exec s3fs aws s3 sync /mnt/ \ + "s3://$BUCKET_PATH/" \ + --exclude "*/tables/teacher/tulsa_model/*" } function main() {