Skip to content

Commit

Permalink
Add cron.sh for scheduled runs
Browse files Browse the repository at this point in the history
  • Loading branch information
travismiller committed Jan 31, 2024
1 parent 33bacbd commit d6b63f0
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
21 changes: 21 additions & 0 deletions cron.sh
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ services:
s3fs:
build: .
privileged: true
restart: unless-stopped
volumes:
- ./volumes/aws-credentials:/root/.aws/credentials
- ./volumes/s3fs-authfile:/root/.s3fs
Expand Down
4 changes: 3 additions & 1 deletion run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit d6b63f0

Please sign in to comment.