[pkg-ntp-maintainers] Bug#635752: Bug#635752: ntp: Please include systemd service file

Alexandre Detiste alexandre.detiste at gmail.com
Wed Sep 10 05:26:48 UTC 2014


Hi,

Here is a revised systemd service file.
I only added a single line "EnvironmentFile=-/etc/default/ntp".

This sources the environment variables in this file
(now only $NTPD_OPTS), only if it exists.

For the "RUNASUSER", it is indeed better to copy & modify the service in /etc/systemd/system .
(changes can be monitored with systemd-delta).

Then there remains the DHCP stuff: I got it working with a small helper script.
Can you include this for Jessie ?

It maybe not a perfect solution, but anyone is welcome to find a better one :-)

-----------------

  [Unit]
  Description=Network Time Protocol daemon
  After=network.target

  [Service]
+ EnvironmentFile=-/etc/default/ntp         
  ExecStartPre=/usr/sbin/ntpconf
  ExecStart=/usr/sbin/ntpd -n $NTPD_OPTS -u ntp:ntp -c /var/lib/ntp/ntp.conf

  [Install]
  WantedBy=multi-user.target

------------

root at raspberrypi:/etc/systemd/system# cat /usr/sbin/ntpconf 
#!/bin/sh
if [ -e /var/lib/ntp/ntp.conf.dhcp ]
then cp /var/lib/ntp/ntp.conf.dhcp /var/lib/ntp/ntp.conf
else cp /etc/ntp.conf /var/lib/ntp/ntp.conf
fi



More information about the pkg-ntp-maintainers mailing list