feat(docker): add DDNS_CRON environment variable for customizable cron schedule#574
Merged
Merged
Conversation
…n schedule Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add environment variable for docker cron job schedule
feat(docker): add DDNS_CRON environment variable for customizable cron schedule
Oct 23, 2025
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces the DDNS_CRON environment variable to allow users to customize the cron schedule for DNS update tasks in Docker containers. Previously, users had to modify /etc/crontabs/root inside containers, but these changes were lost on restart due to the hardcoded 5-minute schedule in the entrypoint script.
Key Changes:
- Implemented
DDNS_CRONenvironment variable with backward-compatible default of*/5 * * * * - Modified Docker entrypoint to use the customizable schedule while maintaining existing behavior when not set
- Added comprehensive documentation in both Chinese and English with examples and cron expression references
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| docker/entrypoint.sh | Core implementation using shell parameter expansion to read DDNS_CRON with fallback to default 5-minute schedule |
| doc/docker.md | Chinese documentation with usage examples, cron expression reference, and Docker Compose configuration |
| doc/docker.en.md | English documentation with usage examples, cron expression reference, and Docker Compose configuration |
| doc/config/env.md | Chinese environment variable reference documentation including DDNS_CRON parameter details |
| doc/config/env.en.md | English environment variable reference documentation including DDNS_CRON parameter details |
NewFuture
approved these changes
Oct 23, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds support for the
DDNS_CRONenvironment variable to allow users to customize the scheduled task execution interval in Docker containers.Problem
Users reported that manually modifying
/etc/crontabs/rootinside Docker containers to change the update frequency doesn't persist after container restarts. The hardcoded 5-minute schedule inentrypoint.shwas overwriting their changes on every restart, making it impossible to customize the update interval without rebuilding the image.Reference: Issue #204 and related user requests
Solution
Implemented the
DDNS_CRONenvironment variable that allows users to specify a custom cron schedule when running the Docker container. The schedule persists across container restarts and requires no modifications to container internals.Implementation Details
docker/entrypoint.shto readDDNS_CRONenvironment variable${DDNS_CRON:-*/5 * * * *}for backward compatibility*/5 * * * *(every 5 minutes) when not setUsage Examples
Basic Usage
Docker Compose
Cron Expression Format
The
DDNS_CRONvariable accepts standard cron expressions in the format:minute hour day month weekdayCommon examples:
*/5 * * * *- Every 5 minutes (default)*/10 * * * *- Every 10 minutes*/15 * * * *- Every 15 minutes0 * * * *- Every hour0 */2 * * *- Every 2 hours0 0 * * *- Daily at midnight0 2 * * *- Daily at 2 AM0 0 * * 0- Weekly on Sunday at midnightDocumentation
Added comprehensive documentation in both Chinese and English:
Backward Compatibility
✅ Fully backward compatible - existing containers continue to work without any changes
DDNS_CRONis not set, defaults to*/5 * * * *(original behavior)DDNS_CRONalso defaults to the original 5-minute scheduleTesting
Files Changed
docker/entrypoint.sh- Core implementation (3 lines modified)doc/docker.md- Chinese Docker documentation (89 lines added)doc/docker.en.md- English Docker documentation (88 lines added)doc/config/env.md- Chinese environment variable documentation (51 lines added)doc/config/env.en.md- English environment variable documentation (51 lines added)Total: 5 files changed, 283 insertions(+), 2 deletions(-)
Original prompt
Fixes #573
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.