Skip to content

Commit

Permalink
fix duplicate crontab entries on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
brettinternet committed Jan 9, 2024
1 parent 76fc91b commit f319f5f
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cloudflare-ddns/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ SCHEDULE=${CRON:-"*/10 * * * *"}

echo "Schedule: $SCHEDULE"

echo "${SCHEDULE} bash /run.sh" >> /etc/crontabs/root
echo "${SCHEDULE} bash /run.sh" > /etc/crontabs/root

crond -f -l 2
2 changes: 1 addition & 1 deletion update-mirrors/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN git config --global --add safe.directory '*'
ENV WORKING_DIRECTORY="/repos"
ENV RUN_ON_STARTUP="true"

COPY start.sh update.sh /
COPY start.sh run.sh /

ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["/start.sh"]
2 changes: 1 addition & 1 deletion update-mirrors/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ docker run --rm \
ghcr.io/brettinternet/update-mirrors
```

These environment variables are also available in the `update.sh` as slots for pre/post commands:
These environment variables are also available in the `run.sh` as slots for pre/post commands:

```yaml
PRE_COMMANDS: |-
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions update-mirrors/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
RUN_ON_STARTUP=$(echo "$RUN_ON_STARTUP" | awk '{print tolower($0)}')

if [ "$RUN_ON_STARTUP" == "true" ]; then
bash /update.sh
bash /run.sh
fi

SCHEDULE=${CRON:-"*/30 * * * *"}

echo "Update schedule: $SCHEDULE"
echo "Schedule: $SCHEDULE"

echo "${SCHEDULE} bash /update.sh" >> /etc/crontabs/root
echo "${SCHEDULE} bash /run.sh" > /etc/crontabs/root

crond -f -l 2

0 comments on commit f319f5f

Please sign in to comment.