-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Configure chrony to use hardware clock on Azure
* On azure stemcells the sync-time script will be overwritten * The chrony-updater-azure will configure chrony to use /dev/ptp0 as hardware clock as described [in azure docs](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/time-sync#chrony) * This prevents the need to configure UDP forwarding rules (necessary for NTP) in the Azure loadbalancer Co-authored-by: David Ansari <david.ansari@sap.com>
- Loading branch information
Showing
3 changed files
with
32 additions
and
0 deletions.
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,13 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
base_dir=$(readlink -nf $(dirname $0)/../..) | ||
source $base_dir/lib/prelude_apply.bash | ||
source $base_dir/lib/prelude_bosh.bash | ||
|
||
if [ ${DISTRIB_CODENAME} == 'xenial' ]; then | ||
cp $dir/assets/chrony-updater-azure $chroot/$bosh_dir/bin/sync-time | ||
chmod 0755 $chroot/$bosh_dir/bin/sync-time | ||
fi | ||
|
18 changes: 18 additions & 0 deletions
18
stemcell_builder/stages/bosh_azure_chrony/assets/chrony-updater-azure
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,18 @@ | ||
#!/bin/bash | ||
|
||
BOSH=/var/vcap/bosh | ||
|
||
exec > $BOSH/log/sync-time.out | ||
exec 2>&1 | ||
|
||
new_file=/etc/chrony/chrony.conf.new | ||
cp /etc/chrony/chrony.conf.base $new_file | ||
|
||
echo "# appended by $0" >> $new_file | ||
|
||
echo "refclock PHC /dev/ptp0 poll 3 dpoll -2 offset 0" >> $new_file | ||
|
||
mv $new_file /etc/chrony/chrony.conf | ||
|
||
systemctl restart chrony.service | ||
chronyc waitsync 10 |