Hide Forgot
Description of problem: The new native systemd service for ntpdate just calls the old sysv init script ( ExecStart=/etc/init.d/ntpdate start ) which just causes confusion. Please probably port the old sysv script to a native systemd one or use the old sysv script only it serves absolutly no purpose keeping both. Version-Release number of selected component (if applicable): How reproducible: Steps to Reproduce: 1. 2. 3. Actual results: Expected results: Additional info:
There is a purpose, the systemd service does more than the init script, it specifies Type=oneshot, etc. Is it possible to include a shell script in the service file or is a wrapping needed?
something like this.. [Unit] Description=Set time via NTP After=syslog.target network.target Before=time-sync.target Wants=time-sync.target [Service] Type=oneshot EnvironmentFile=/etc/sysconfig/ntpdate ExecStartPre=/path/to/scripts/that/sets/tickers-variable ExecStart=/usr/sbin/ntpdate -U ntp -s -b $OPTIONS $tickers ExecStartPost=/sbin/hwclock "$SYNC_HWCLOCK" ( set variable to "-w" or "" not yes ) RemainAfterExit=yes [Install] WantedBy=multi-user.target
This omits the loop around ntpdate which is needed to wait for network connection.
If After=network.target is not sufficiant try Requires= as in .. ( see man systemd.unit ) [Unit] Description=Set time via NTP Requires=network.target After=syslog.target network.target Before=time-sync.target Wants=time-sync.target [Service] Type=oneshot EnvironmentFile=/etc/sysconfig/ntpdate ExecStartPre=/path/to/scripts/that/sets/tickers-variable ExecStart=/usr/sbin/ntpdate -U ntp -s -b $OPTIONS $tickers ExecStartPost=/sbin/hwclock "$SYNC_HWCLOCK" ( set variable to "-w" or "" not yes ) RemainAfterExit=yes [Install] WantedBy=multi-user.target btw ntp(date) causes delay at startup and should only be enabled via anaconda/firstboot/*de-app or end user via cmd not by default
IIRC network.target is only that NetworkManager is running, not that a network is available. It would be really nice if a network-online existed. ntpdate is disabled by default.
Even if it is enabled it shouldn't block delay, but apparently does, see bug #679537.
Fixed in ntp-4.2.6p3-5.fc16. The SysV init script code has been moved to /usr/libexec/ntpdate-wrapper.