diff --git a/Dockerfile b/Dockerfile index fe558cb..56c4441 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,6 +32,7 @@ ENV CLOUDFLARE_CONFIG=/app/config.yaml ENV PUID=1001 ENV PGID=1001 ENV NODE_ENV=production +ENV CRON='*/5 * * * *' COPY --from=builder /packages /app/packages/ COPY package.json package-lock.json /app/ diff --git a/README.md b/README.md index de12c47..05afa8f 100644 --- a/README.md +++ b/README.md @@ -202,17 +202,18 @@ ipv6: > If configuration file is found, environment variables are ignored. -| Parameters | Default | Description | -| ------------ | ------- | -------------------------------------------------------------------------------------------------------------------------- | -| \*ZONE | | Domain, e.g. `example.com`. | -| \*HOST | | DNS record to be updated, e.g. `example.com`, `subdomain.example.com`. | -| \*EMAIL | | Cloudflare Email | -| \*API | | Cloudflare API key | -| PROXY | true | Whether the record is receiving the performance and security benefits of Cloudflare. `true` to enable; `false` to disable. | -| FORCE_CREATE | | When set, a record will be created if one does not exist already. | -| IPV6 | | When set, update IPv6 instead of IPv4. | -| PUID | | User ID used by the script. | -| PGID | | Group ID used by the script. | +| Parameters | Default | Description | +| ------------ | ----------------- | -------------------------------------------------------------------------------------------------------------------------- | +| \*ZONE | | Domain, e.g. `example.com`. | +| \*HOST | | DNS record to be updated, e.g. `example.com`, `subdomain.example.com`. | +| \*EMAIL | | Cloudflare Email | +| \*API | | Cloudflare API key | +| PROXY | true | Whether the record is receiving the performance and security benefits of Cloudflare. `true` to enable; `false` to disable. | +| FORCE_CREATE | | When set, a record will be created if one does not exist already. | +| IPV6 | | When set, update IPv6 instead of IPv4. | +| PUID | | User ID used by the script. | +| PGID | | Group ID used by the script. | +| CRON | \*\/5 \* \* \* \* | DDNS update schedule. | \* These parameters are required. diff --git a/docker/root/etc/cont-init.d/11-cron b/docker/root/etc/cont-init.d/11-cron new file mode 100644 index 0000000..2918127 --- /dev/null +++ b/docker/root/etc/cont-init.d/11-cron @@ -0,0 +1,5 @@ +#!/usr/bin/with-contenv sh + +echo "Setting crontab to ${CRON}" +echo "${CRON} /app/cloudflare.sh" >> /etc/crontabs/root +chmod 600 /etc/crontabs/root diff --git a/docker/root/etc/crontabs/root b/docker/root/etc/crontabs/root deleted file mode 100644 index b1e1768..0000000 --- a/docker/root/etc/crontabs/root +++ /dev/null @@ -1 +0,0 @@ -*/5 * * * * /app/cloudflare.sh diff --git a/package-lock.json b/package-lock.json index b5549ce..b4941b7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10960,7 +10960,7 @@ }, "node_modules/npm/node_modules/lodash._baseindexof": { "version": "3.1.0", - "dev": true, + "extraneous": true, "inBundle": true, "license": "MIT" }, @@ -10976,19 +10976,19 @@ }, "node_modules/npm/node_modules/lodash._bindcallback": { "version": "3.0.1", - "dev": true, + "extraneous": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/lodash._cacheindexof": { "version": "3.0.2", - "dev": true, + "extraneous": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/lodash._createcache": { "version": "3.1.2", - "dev": true, + "extraneous": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -11003,7 +11003,7 @@ }, "node_modules/npm/node_modules/lodash._getnative": { "version": "3.9.1", - "dev": true, + "extraneous": true, "inBundle": true, "license": "MIT" }, @@ -11021,7 +11021,7 @@ }, "node_modules/npm/node_modules/lodash.restparam": { "version": "3.6.1", - "dev": true, + "extraneous": true, "inBundle": true, "license": "MIT" }, @@ -25121,7 +25121,7 @@ "lodash._baseindexof": { "version": "3.1.0", "bundled": true, - "dev": true + "extraneous": true }, "lodash._baseuniq": { "version": "4.6.0", @@ -25135,17 +25135,17 @@ "lodash._bindcallback": { "version": "3.0.1", "bundled": true, - "dev": true + "extraneous": true }, "lodash._cacheindexof": { "version": "3.0.2", "bundled": true, - "dev": true + "extraneous": true }, "lodash._createcache": { "version": "3.1.2", "bundled": true, - "dev": true, + "extraneous": true, "requires": { "lodash._getnative": "^3.0.0" } @@ -25158,7 +25158,7 @@ "lodash._getnative": { "version": "3.9.1", "bundled": true, - "dev": true + "extraneous": true }, "lodash._root": { "version": "3.0.1", @@ -25173,7 +25173,7 @@ "lodash.restparam": { "version": "3.6.1", "bundled": true, - "dev": true + "extraneous": true }, "lodash.union": { "version": "4.6.0",