Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== Синхронизация времени с сервером ====== ===== Вариант 1 (рекомендуемый) ===== * Скачать и запустить на Windows машине с админ правами [[doc:jroboplc:NTP_server_setup|NTP_server_setup.bat]] (или тут [[https://ncloud.dssl.ru/s/Q982j7mxdAQSkGs|NTP_server_setup.bat]] [[https://confluence.trassir.com/pages/viewpage.action?pageId=67246747|src]]) * Настроить клиента на Ubuntu машине:<code bash> sudo mcedit /etc/systemd/timesyncd.conf</code><code bash> [Time] NTP=192.168.2.2 # windows computer with ntp service #FallbackNTP= RootDistanceMaxSec=30 #PollIntervalMinSec=32 #PollIntervalMaxSec=2048</code> * Перезапустить сервис и проверить статус:<code bash> sudo systemctl restart systemd-timesyncd systemctl status systemd-timesyncd timedatectl status timedatectl timesync-status </code> * Установить часовой пояс: <code bash> sudo timedatectl set-timezone Etc/GMT-7 # для Барнаула sudo timedatectl set-timezone Etc/GMT-5 # для Челябинска</code> ===== Вариант 2 ===== ==== Настройка сервера ntp ==== Проверено на Windows 7. <code> HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters\Type = NTP HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config\AnnounceFlags = 5 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer\Enabled = 1 w32tm /config /update net stop w32time && net start w32time </code> ==== Настройка клиента ==== Клиентом является jroboplc под управление linux. ''sudo mcedit /etc/hosts'' 192.168.1.50 ntpserver # адрес сервера ntp ''sudo mcedit /etc/rc.local'' <code bash> /sbin/hwclock -s ( while true; do if ifconfig eth0|grep 'inet ' > null; then if ping -nq -c3 ntpserver > null; then break; fi fi sleep 1 # echo "waiting" done echo "TimeSync: ready to sync" ntpdate ntpserver /sbin/hwclock -w date echo "TimeSync: OK" )& </code> Если еще не установлено ''ntpdate'', то установить: sudo apt-get install ntpdate doc/jroboplc/setup_ntp.txt Last modified: 2024/02/22 06:43by 127.0.0.1