Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Cron Job to update csv #513

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docker-compose.production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,8 @@ services:
- POSTGRES_DB=yacs
- POSTGRES_USER=yacs
- POSTGRES_PASSWORD=${DB_PASS:-easy_dev_pass}

yacs_update:
build:
context: ./rpi_data
dockerfile: Dockerfile
6 changes: 6 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,9 @@ services:
restart: unless-stopped
container_name: yacs_db
image: postgres:12-alpine

yacs_update:
restart: unless-stopped
container_name: yacs_update
depends_on:
- yacs_db
17 changes: 17 additions & 0 deletions rpi_data/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM ubuntu:latest

# Add cron_update file in the cron directory
ADD cron_update /etc/cron.daily/cron_update

# Give execution rights on the cron job
RUN chmod 0644 /etc/cron.d/cron_update

# Create the log file to be able to run tail
RUN touch /var/log/cron.log

#Install Cron
RUN apt-get update
RUN apt-get -y install cron

# Run the command on container startup
CMD cron && tail -f /var/log/cron.log
2 changes: 2 additions & 0 deletions rpi_data/cron_update
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
0 0 * * * root ./get-spring-2022.sh
#This is a cron job