Bug 697529 - ntpdate systemd service scripts just calls the old sysv initscript
Summary: ntpdate systemd service scripts just calls the old sysv initscript
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: ntp
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miroslav Lichvar
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-04-18 14:24 UTC by Jóhann B. Guðmundsson
Modified: 2011-07-20 11:57 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-07-20 11:57:13 UTC
Type: ---


Attachments (Terms of Use)

Description Jóhann B. Guðmundsson 2011-04-18 14:24:31 UTC
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:

Comment 1 Miroslav Lichvar 2011-04-18 14:32:20 UTC
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?

Comment 2 Jóhann B. Guðmundsson 2011-04-18 15:08:00 UTC
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

Comment 3 Miroslav Lichvar 2011-04-18 15:17:21 UTC
This omits the loop around ntpdate which is needed to wait for network connection.

Comment 4 Jóhann B. Guðmundsson 2011-04-18 15:30:23 UTC
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

Comment 5 Miroslav Lichvar 2011-04-18 15:35:39 UTC
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.

Comment 6 Miroslav Lichvar 2011-04-18 15:38:04 UTC
Even if it is enabled it shouldn't block delay, but apparently does, see bug #679537.

Comment 7 Miroslav Lichvar 2011-07-20 11:57:13 UTC
Fixed in ntp-4.2.6p3-5.fc16. The SysV init script code has been moved to /usr/libexec/ntpdate-wrapper.


Note You need to log in before you can comment on or make changes to this bug.