Script to update the timezone in specified AGiXT Docker Compose files to the current server timezone. #1106
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.
Explanation of the script:
Determine Current Timezone:
Use timedatectl to retrieve information about the current server timezone.
awk extracts the timezone information from the output.
Function to Replace Timezone:
Define a function replace_timezone that takes a file as an argument and uses sed to replace the timezone pattern in the file.
The pattern TZ=${TZ-[^}]*} matches strings like TZ=${TZ-America/New_York} or similar.
Array of Files:
Create an array compose_files containing the names of Docker Compose files to be updated.
Update Each File:
Iterate through the array of files and call the replace_timezone function for each file.
Display Success Message:
Print a message indicating that the timezone in the files has been successfully updated to the current server timezone.
This script ensures that the timezone pattern in the specified Docker Compose files is replaced with the current server timezone.
Description
Motivation and Context
How has this been tested?
Screenshots (if appropriate)
Types of changes
Changes visible to users:
fix
- non-breaking change which fixes an issue)feat
- non-breaking change which adds functionality)feat!!
orfix!!
- fix or feature that would cause existing functionality to not work as expected)Internal changes:
refactor
- non-breaking change which only improves the design or structure of existing code, and making no changes to its external behaviour)test
- additions and improvements to unit tests and the smoke tests)chore
- examples include GitHub Actions, issue templates)Checklist
yarn run lint
.