mirror of
https://github.com/yavook/kiwi-cron.git
synced 2024-11-21 06:53:01 +00:00
Time Zones
This commit is contained in:
parent
0cd472a08f
commit
1d0ef14827
3 changed files with 13 additions and 0 deletions
|
@ -1,5 +1,7 @@
|
|||
FROM alpine:latest
|
||||
|
||||
ENV TZ=Etc/UTC
|
||||
|
||||
RUN set -ex; \
|
||||
\
|
||||
mkdir -pm 755 /kiwi-cron; \
|
||||
|
@ -16,6 +18,7 @@ RUN set -ex; \
|
|||
\
|
||||
apk --no-cache add \
|
||||
docker-cli \
|
||||
tzdata \
|
||||
;
|
||||
|
||||
COPY bin /usr/local/bin/
|
||||
|
|
|
@ -28,6 +28,12 @@ For each subdirectory, a random valid cron schedule is generated, so that:
|
|||
|
||||
Cron schedules are regenerated once on each startup, only for directories that have files.
|
||||
|
||||
## Time Zones
|
||||
|
||||
`kiwi-cron` images include the `tzdata` package and automatically handle `/etc/localtime` on startup. By default, "Etc/UTC" is set as the container time zone.
|
||||
|
||||
To use a different time zone, change the container environment variable `TZ` to your liking, e.g. "Europe/Berlin".
|
||||
|
||||
## Finer granularity: The `/kiwi-cron/every` directory
|
||||
|
||||
Directories like `/kiwi-cron/every/5_minutes` will run scripts every 5 minutes.
|
||||
|
|
4
libexec/kiwi-cron/run_cron
Normal file → Executable file
4
libexec/kiwi-cron/run_cron
Normal file → Executable file
|
@ -1,5 +1,9 @@
|
|||
#!/bin/sh
|
||||
|
||||
# set timezone
|
||||
export TZ="${TZ:-Etc/UTC}"
|
||||
ln -sf "/usr/share/zoneinfo/${TZ}" "/etc/localtime"
|
||||
|
||||
# check for CLI options
|
||||
while getopts ':n' rc_optarg; do
|
||||
case "${rc_optarg}" in
|
||||
|
|
Loading…
Reference in a new issue