-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
support set timezone in ConfigDB #2568
Closed
Closed
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a1e2dc8
[baseimage] set default locale en_US.UTF-8
richard28530 c61aadb
[baseimage]set default locale to en_US.UTF-8, clean all other unused
richard28530 fd7073a
[baseimage] update-locale after locale-gen
richard28530 6957749
correct update-locale command line
lguohan de40c27
Merge from Azure/master
richard28530 ad2ac36
support timezone setting in ConfigDB
richard28530 b4e92da
[timezone] use -n for non-zero length judgement
richard28530 9ca4b0a
add double quote
richard28530 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[Unit] | ||
Description=Update timezone based on configdb | ||
Requires=updategraph.service | ||
After=updategraph.service | ||
|
||
[Service] | ||
Type=oneshot | ||
ExecStart=/usr/bin/timezone-config.sh | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash -e | ||
|
||
CURRENT_TIMEZONE=`cat /etc/timezone` | ||
TIMEZONE=`sonic-cfggen -d -v DEVICE_METADATA[\'localhost\'][\'timezone\']` | ||
|
||
if [ -n $TIMEZONE ] | ||
then | ||
sudo bash -c "echo $TIMEZONE > /etc/timezone" | ||
sudo bash -c "dpkg-reconfigure -f noninteractive tzdata" | ||
sudo bash -c "systemctl restart rsyslog" | ||
sudo bash -c "systemctl restart cron" | ||
fi |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't these already run as root ? Why need "sudo bash -c " ?
Could you use "timedatectl settimezone US/Pacific" to set the timezone instead of directly modifying the files ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left previous company i can't modify this pull request any more.