{"id":120,"date":"2013-03-11T08:40:02","date_gmt":"2013-03-11T07:40:02","guid":{"rendered":"http:\/\/sam-soul.fr\/Info\/?p=120"},"modified":"2019-10-03T09:08:42","modified_gmt":"2019-10-03T07:08:42","slug":"heure-systeme-sur-un-linux-2","status":"publish","type":"post","link":"http:\/\/les-fougs.com\/wordpress\/2013\/03\/11\/heure-systeme-sur-un-linux-2\/","title":{"rendered":"Heure systeme sur un Linux"},"content":{"rendered":"<p><strong>Ubuntu 18.04 :<\/strong><\/p>\n<p>sudo apt install ntp<\/p>\n<p><strong>Serveur WCT :<\/strong><br \/>\n<strong>vim \/etc\/ntp.conf<\/strong><\/p>\n<pre style=\"padding-left: 30px;\">server timeserver.wabtec.com\nrestrict timeserver.wabtec.com mask 255.255.255.255 nomodify\nnotrap noquery\nserver 10.129.20.20<\/pre>\n<p><strong><br \/>\nservice ntpd stop<br \/>\nservice ntpd start<br \/>\nservice ntpd restart<\/strong><\/p>\n<p>cat \/var\/log\/messages<\/p>\n<hr \/>\n<h5>Sur EL7 (octal_V15)<\/h5>\n<pre><em>root@wctsrv0057:~# timedatectl\n Local time: Tue 2019-10-01 15:30:45 CEST\nUniversal time: Tue 2019-10-01 13:30:45 UTC\nRTC time: Tue 2019-10-01 12:24:05\nTime zone: Europe\/Paris (CEST, +0200)\nNTP enabled: yes\nNTP synchronized: yes\nRTC in local TZ: no\nDST active: yes\nLast DST change: DST began at\nSun 2019-03-31 01:59:59 CET\nSun 2019-03-31 03:00:00 CEST\nNext DST change: DST ends (the clock jumps one hour backwards) at\nSun 2019-10-27 02:59:59 CEST\nSun 2019-10-27 02:00:00 CET<\/em><\/pre>\n<pre><em>root@wctsrv0057:~# timedatectl set-ntp false\n<\/em><\/pre>\n<pre><em>root@wctsrv0057:~# timedatectl\nLocal time: Tue 2019-10-01 15:35:05 CEST\nUniversal time: Tue 2019-10-01 13:35:05 UTC\nRTC time: Tue 2019-10-01 12:28:25\nTime zone: Europe\/Paris (CEST, +0200)\n<strong>NTP enabled: no<\/strong>\nNTP synchronized: yes\nRTC in local TZ: no\nDST active: yes\nLast DST change: DST began at\nSun 2019-03-31 01:59:59 CET\nSun 2019-03-31 03:00:00 CEST\nNext DST change: DST ends (the clock jumps one hour backwards) at\nSun 2019-10-27 02:59:59 CEST\nSun 2019-10-27 02:00:00 CET\n<\/em><\/pre>\n<p>root@wctsrv0057:~# systemctl enable ntpd.service<\/p>\n<hr \/>\n<p><strong>Pour voir la date et l&rsquo;heure actuelle<\/strong><\/p>\n<p><strong>date<\/strong><\/p>\n<p>Pour changer l&rsquo;heure<\/p>\n<p><strong>date -s &laquo;&nbsp;09:56:00&nbsp;&raquo;<\/strong><\/p>\n<p>Pour changer le jour<\/p>\n<p><strong>date -s &laquo;&nbsp;2011-03-22&nbsp;&raquo;<\/strong><\/p>\n<p>Mise \u00e0 jour automatique de l&rsquo;heure<\/p>\n<p>Ajouter le service ntp<\/p>\n<p>sous Ubuntu ou Debian<br \/>\n<strong>sudo apt-get install ntp<\/strong><\/p>\n<p>sous Redhat ou centos<br \/>\n<strong>yum install ntp<\/strong><\/p>\n<p>Lancer le service<\/p>\n<p><strong>sudo service ntpd start<\/strong><br \/>\nou<br \/>\n<strong>sudo service ntpd restart<\/strong><\/p>\n<p><strong>sudo service ntp start<\/strong><br \/>\nou<br \/>\n<strong>sudo service ntp restart<\/strong><\/p>\n<p><strong>ps -ef | grep ntp<\/strong><\/p>\n<p><strong> vi \/etc\/ntp.conf<\/strong><\/p>\n<p># \/etc\/ntp.conf, configuration for ntpd; see ntp.conf(5) for help<\/p>\n<p>driftfile \/var\/lib\/ntp\/ntp.drift<br \/>\n# Enable this if you want statistics to be logged.<br \/>\n#statsdir \/var\/log\/ntpstats\/<\/p>\n<p>statistics loopstats peerstats clockstats<br \/>\nfilegen loopstats file loopstats type day enable<br \/>\nfilegen peerstats file peerstats type day enable<br \/>\nfilegen clockstats file clockstats type day enable<br \/>\n# You do need to talk to an NTP server or two (or three).<br \/>\n#server ntp.ubuntu.com<br \/>\n#server 10.20.112.64<br \/>\nserver pft.ft.grp<\/p>\n<p># Access control configuration; see \/usr\/share\/doc\/ntp-doc\/html\/accopt.html for<br \/>\n# details. The web page &lt;http:\/\/support.ntp.org\/bin\/view\/Support\/AccessRestrictions&gt;<br \/>\n# might also be helpful.<br \/>\n#<br \/>\n# Note that &laquo;&nbsp;restrict&nbsp;&raquo; applies to both servers and clients, so a configuration<br \/>\n# that might be intended to block requests from certain clients could also end<br \/>\n# up blocking replies from your own upstream servers.<\/p>\n<p># By default, exchange time with everybody, but don&rsquo;t allow configuration.<br \/>\nrestrict -4 default kod notrap nomodify nopeer noquery<br \/>\nrestrict -6 default kod notrap nomodify nopeer noquery<\/p>\n<p># Local users may interrogate the ntp server more closely.<br \/>\nrestrict 127.0.0.1<br \/>\nrestrict ::1<\/p>\n<p># Clients from this (example!) subnet have unlimited access, but only if<br \/>\n# cryptographically authenticated.<br \/>\n#restrict 192.168.123.0 mask 255.255.255.0 notrust<br \/>\n# If you want to provide time to your local subnet, change the next line.<br \/>\n# (Again, the address is an example only.)<br \/>\n#broadcast 192.168.123.255<\/p>\n<p># If you want to listen to time broadcasts on your local subnet, de-comment the<br \/>\n# next lines. Please do this only if you trust everybody on the network!<br \/>\n#disable auth<br \/>\n#broadcastclient<\/p>\n<p>Par d\u00e9fault on a :<\/p>\n<p>\/etc\/init.d\/ntp<br \/>\n\/etc\/rc1.d\/K77ntp<br \/>\n\/etc\/rc2.d\/S23ntp<br \/>\n\/etc\/rc3.d\/S23ntp<br \/>\n\/etc\/rc4.d\/S23ntp<br \/>\n\/etc\/rc5.d\/S23ntp<\/p>\n<p>ln -s ..\/init.d\/ntp \/etc\/rc1.d\/K77ntp<br \/>\nln -s ..\/init.d\/ntp \/etc\/rc2.d\/S23ntp<br \/>\nln -s ..\/init.d\/ntp \/etc\/rc3.d\/S23ntp<br \/>\nln -s ..\/init.d\/ntp \/etc\/rc4.d\/S23ntp<br \/>\nln -s ..\/init.d\/ntp \/etc\/rc5.d\/S23ntp<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ubuntu 18.04 : sudo apt install ntp Serveur WCT : vim \/etc\/ntp.conf server timeserver.wabtec.com restrict timeserver.wabtec.com mask 255.255.255.255 nomodify notrap noquery server 10.129.20.20 service ntpd stop service ntpd start service ntpd restart cat \/var\/log\/messages Sur EL7 (octal_V15) root@wctsrv0057:~# timedatectl Local time: Tue 2019-10-01 15:30:45 CEST Universal time: Tue 2019-10-01 13:30:45 UTC RTC time: Tue 2019-10-01 &hellip; <a href=\"http:\/\/les-fougs.com\/wordpress\/2013\/03\/11\/heure-systeme-sur-un-linux-2\/\" class=\"more-link\">Continuer la lecture<span class=\"screen-reader-text\"> de &laquo;&nbsp;Heure systeme sur un Linux&nbsp;&raquo;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[51],"tags":[],"_links":{"self":[{"href":"http:\/\/les-fougs.com\/wordpress\/wp-json\/wp\/v2\/posts\/120"}],"collection":[{"href":"http:\/\/les-fougs.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/les-fougs.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/les-fougs.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/les-fougs.com\/wordpress\/wp-json\/wp\/v2\/comments?post=120"}],"version-history":[{"count":13,"href":"http:\/\/les-fougs.com\/wordpress\/wp-json\/wp\/v2\/posts\/120\/revisions"}],"predecessor-version":[{"id":2293,"href":"http:\/\/les-fougs.com\/wordpress\/wp-json\/wp\/v2\/posts\/120\/revisions\/2293"}],"wp:attachment":[{"href":"http:\/\/les-fougs.com\/wordpress\/wp-json\/wp\/v2\/media?parent=120"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/les-fougs.com\/wordpress\/wp-json\/wp\/v2\/categories?post=120"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/les-fougs.com\/wordpress\/wp-json\/wp\/v2\/tags?post=120"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}