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

Can this run on a schedule? #14

Open
jglee10 opened this issue Dec 13, 2021 · 2 comments
Open

Can this run on a schedule? #14

jglee10 opened this issue Dec 13, 2021 · 2 comments

Comments

@jglee10
Copy link

jglee10 commented Dec 13, 2021

I am able to get the docker image to run this one time (results = NONE), is there a way to get this to run on a schedule?

@eosti
Copy link
Contributor

eosti commented Apr 4, 2023

Currently, this is not supported in the provided Dockerfile.

The easiest (and hackiest) way to schedule it is adding --restart=always to your docker run command. Every time the checker runs, it will exit shortly afterwards causing the container to exit. The --restart=always will make Docker restart the container after a little bit, though that delay is exponential according to the restart policy. I'm using this, and it gives ~1min between runs.

Alternate ways that would require more work (but are more "correct"):

  • Add a crontab into the dockerfile to schedule the running of the checker
  • Make the entrypoint to the container a shell script that runs the checker in an infinite loop with a delay
  • Add an infinite loop with delay in the python code itself

@everettsouthwick
Copy link

I've refactored the script to support a schedule if you want to check it out https://github.com/everettsouthwick/trusted-traveler-scheduler

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants