Sync network time when a connection comes up

This commit is contained in:
Luxferre committed 2026-11-07 21:53:07 +02:00
1 parent 38d54f10ff
commit 9ac39ce6bf
13 files changed
+365 -8

No files matched your search

@@ -0,0 +1,9 @@
#!/bin/sh
# NetworkManager dispatcher: refresh NTP sources when a connection comes up.
# The helper throttles and waits for chronyd, so run it without blocking NM.
case "$2" in
up|dhcp4-change|dhcp6-change|dns-change|connectivity-change|vpn-up) ;;
*) exit 0 ;;
esac
/usr/bin/bananarchy-time-sync.sh network-up >/dev/null 2>&1 &
exit 0
+5 -4
View File
@@ -1,7 +1,8 @@
# Bananarchy: long NTP polls so chronyd does not keep waking Wi-Fi (U6).
# After a long uptime chronyd ramps to maxpoll anyway; this makes it explicit
# and removes the initial iburst burst of packets.
pool pool.ntp.org minpoll 12 maxpoll 16
# Bananarchy: long NTP polls keep Wi-Fi asleep between measurements. iburst
# syncs the clock as soon as the pool resolves (at boot or after a network-up
# refresh). cmdport 0 keeps the UDP command port closed; the network-up hook
# uses chronyd's root-only Unix command socket instead.
pool pool.ntp.org iburst minpoll 12 maxpoll 16
driftfile /var/lib/chrony/chrony.drift
rtcsync
cmdport 0
+2
View File
@@ -54,6 +54,8 @@ permit nopass :wheel as root cmd bananarchy-privacy-ctl
permit nopass :wheel as root cmd /usr/bin/bananarchy-display-power-sync
permit nopass :wheel as root cmd /usr/bin/bananarchy-power-policy.sh
permit nopass :wheel as root cmd bananarchy-power-policy.sh
permit nopass :wheel as root cmd /usr/bin/bananarchy-time-sync.sh
permit nopass :wheel as root cmd bananarchy-time-sync.sh
permit nopass :wheel as root cmd bananarchy-display-power-sync
permit nopass :wheel as root cmd /usr/bin/plymouth args quit
permit nopass :wheel as root cmd plymouth args quit
+15
View File
@@ -0,0 +1,15 @@
#!/sbin/openrc-run
name="Bananarchy network time sync"
description="Trigger NTP synchronisation once the network is up"
depend() {
need chronyd net
after networkmanager
}
start() {
ebegin "Triggering Bananarchy network time synchronisation"
/usr/bin/bananarchy-time-sync.sh boot >/dev/null 2>&1 &
eend 0
}