chore: verify time sync (systemd-timesyncd) during deployment
This commit is contained in:
parent
0f78666bf3
commit
f1fbd01c19
1 changed files with 18 additions and 0 deletions
18
setup.sh
18
setup.sh
|
|
@ -56,6 +56,24 @@ if ! command -v curl &>/dev/null; then
|
||||||
sudo apt-get install -y -qq curl
|
sudo apt-get install -y -qq curl
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# ── 1b. Verify time synchronization (critical for NVR timestamps) ──
|
||||||
|
log "Checking time sync..."
|
||||||
|
if systemctl is-active --quiet systemd-timesyncd 2>/dev/null; then
|
||||||
|
log "systemd-timesyncd is active."
|
||||||
|
elif ! timedatectl status 2>/dev/null | grep -q "System clock synchronized: yes"; then
|
||||||
|
warn "Time sync is NOT active. Enabling systemd-timesyncd..."
|
||||||
|
sudo systemctl enable --now systemd-timesyncd 2>/dev/null || true
|
||||||
|
sudo timedatectl set-ntp true 2>/dev/null || true
|
||||||
|
log "Time sync enabled."
|
||||||
|
else
|
||||||
|
log "Time sync is active."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Verify timezone is sensible.
|
||||||
|
TZ=$(timedatectl show --property=Timezone --value 2>/dev/null || echo "unknown")
|
||||||
|
log "Timezone: ${TZ}"
|
||||||
|
log "Local time: $(date)"
|
||||||
|
|
||||||
# ── 2. Install Go (user-local, no sudo needed after download) ──
|
# ── 2. Install Go (user-local, no sudo needed after download) ──
|
||||||
log "Step 2/6: Setting up Go ${GO_VERSION}..."
|
log "Step 2/6: Setting up Go ${GO_VERSION}..."
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue