Skip to content

Conversation

mrwogu
Copy link

@mrwogu mrwogu commented May 26, 2025

Overview

This PR adds robust timezone support for scheduled backups.

Features

  • Added support for the TZ environment variable to control the timezone used for scheduled backups.
  • If TZ is set, all scheduled backups are interpreted in the specified timezone. If not set, the system default timezone is used.
  • If an invalid timezone is provided, the process will exit with an error message.
  • The backup startup message now displays the active timezone for clarity.

Implementation

  • Introduced the use of pytz to handle timezone conversion in the backup process.
  • Updated the backup entrypoint and scheduling logic to print the current value of TZ.
  • Added a dedicated test (test_backup_timezone) to verify that the backup logic correctly applies the timezone from the TZ environment variable.

Documentation

  • Added a new "Timezone support" section to the README.md, including usage examples for setting the TZ environment variable in your environment or docker-compose.yml.

Testing

  • Added a comprehensive test for timezone support in backup scheduling.

Use Case

This addresses the use case where users need to run scheduled backups in specific timezones, ensuring correct backup timing regardless of the system locale.


Closes #77

@mrwogu mrwogu force-pushed the feature/tz-support branch 2 times, most recently from 53c8e68 to 6f7e25c Compare May 27, 2025 21:38
@mrwogu mrwogu force-pushed the feature/tz-support branch from 6f7e25c to 015b13d Compare May 27, 2025 21:57
@mrwogu mrwogu marked this pull request as draft May 28, 2025 21:57
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

Successfully merging this pull request may close these issues.

Timezone for SCHEDULE
1 participant