salut
Pour info depuis systemd les réglages horloge se font avec timedatectl et on peut se passer de ntp et ntpdate
https://www.freedesktop.org/software/systemd/man/timedatectl.html
-
Le fichier de conf pour indiquer les serveur ntp à atteindre
root@debian:/# cat /etc/systemd/timesyncd.conf
This file is part of systemd.
systemd is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
Entries in this file show the compile time defaults.
You can change settings by editing this file.
Defaults can be restored by simply deleting this file.
See timesyncd.conf(5) for details.
[Time]
NTP=ntp.obspm.fr ntp1.jussieu.fr
FallbackNTP=canon.inria.fr -
Activer la synchronisation:
sudo timedatectl set-ntp true
-
Vérifier:
@debian:~$ timedatectl
Local time: dim. 2016-05-22 20:17:09 CEST
Universal time: dim. 2016-05-22 18:17:09 UTC
RTC time: dim. 2016-05-22 18:17:09
Time zone: Europe/Paris (CEST, +0200)
Network time on: yes
NTP synchronized: yes
RTC in local TZ: noroot@debian:/# systemctl status time*
● time-sync.target - System Time Synchronized
Loaded: loaded (/lib/systemd/system/time-sync.target; static; vendor preset:
Active: active since dim. 2016-05-22 20:43:27 CEST; 5min ago
Docs: man:systemd.special(7)mai 22 20:43:27 debian systemd[1]: Reached target System Time Synchronized.
● timers.target - Timers
Loaded: loaded (/lib/systemd/system/timers.target; static; vendor preset: ena
Active: active since dim. 2016-05-22 20:43:29 CEST; 5min ago
Docs: man:systemd.special(7)mai 22 20:43:29 debian systemd[1]: Reached target Timers.
-
L’horodatage de la dernière synchro
root@debian:/# ls -alrt /var/lib/systemd/clock
-rw-r–r-- 1 systemd-timesync systemd-timesync 0 mai 22 20:48 /var/lib/systemd/clock -
La vérification de l’accès au serveur ntp
systemctl status systemd-timesyncd.service
● systemd-timesyncd.service - Network Time Synchronization
Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2017-10-12 21:21:35 CEST; 59min ago
Docs: man:systemd-timesyncd.service(8)
Main PID: 496 (systemd-timesyn)
Status: "Synchronized to time server 145.238.203.10:123 (ntp.obspm.fr)."
Tasks: 2 (limit: 4915)
CGroup: /system.slice/systemd-timesyncd.service
└─496 /lib/systemd/systemd-timesyncd
oct. 12 21:21:35 debian systemd[1]: Starting Network Time Synchronization...
oct. 12 21:21:35 debian systemd[1]: Started Network Time Synchronization.
oct. 12 21:22:06 debian systemd-timesyncd[496]: Synchronized to time server 145.238.203.10:123 (ntp.obspm.fr).