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

TZ environment variable does not work #374

Open
lansaloni opened this issue Nov 20, 2024 · 3 comments
Open

TZ environment variable does not work #374

lansaloni opened this issue Nov 20, 2024 · 3 comments

Comments

@lansaloni
Copy link

Hi!
In the examples/docker-compose.yaml file there is the TZ environment variable but if I set it to a value other than UTC the container remains in UTC.
I tried with:
TZ: CET
or
TZ: Europe/Rome
but the date inside the container is always UTC:

386c48494a44:/$ date
Wed Nov 20 11:48:06 UTC 2024
@deitch
Copy link
Collaborator

deitch commented Nov 20, 2024

Hi again @lansaloni .

there is the TZ environment variable but if I set it to a value other than UTC the container remains in UTC.

Ah, that is an issue. The old script-based version (everything pre v1.0.0) supported it. It was useful to some people, but caused big headaches. What does it mean to have the TZ provided? How does the schedule get calculated? How do we timestamp files?

The purpose of TZ wasn't to change the date inside the container, but primarily to affect someone who used cron to schedule dumps. That allowed them to set the TZ for it. Since it wasn't using the system cron, but rather calculating it directly inside the program, you could have the container be whatever timezone it wanted (normally UTC), but calculate the cron according to that timezone.

The timestamps on the files themselves, however, and logs, always were and would remain UTC.

To summarize:

  1. TZ is a legacy from how cron scheduling was calculated, nothing else
  2. File timestamps and logs and all else always were UTC
  3. It doesn't work now, the docs should be updated to reflect that
  4. I am quite open to the idea of a PR to add support for it in terms of how to read cron.

Does that answer?

@skywalkerisnull
Copy link

Just putting this here in case others come across it.

If you need to do a cron task that goes past midnight (such as you are in GMT+10 and want the backups to be throughout the "working day"), then you can do something similar to this: 0 22-23,0-9 * * *

@deitch
Copy link
Collaborator

deitch commented Dec 9, 2024

Do you want to PR the docs, add the timezone description and include this?

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