diff mbox series

[2/3] package: linuxptp: enhance systemd service

Message ID 1517155221-19399-2-git-send-email-brain@jikos.cz
State Accepted
Headers show
Series [1/3] package: linuxptp: bump to the latest GIT version | expand

Commit Message

Petr Kulhavy Jan. 28, 2018, 4 p.m. UTC
linuxptp now pulls in the time-sync.target
phc2sys (linuxptp-system-clock.service) starts after ptp4l (linuxptp.service)

Signed-off-by: Petr Kulhavy <brain@jikos.cz>
---
 package/linuxptp/linuxptp-system-clock.service | 2 +-
 package/linuxptp/linuxptp.service              | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

Comments

Thomas Petazzoni Jan. 30, 2018, 10 p.m. UTC | #1
Hello,

On Sun, 28 Jan 2018 17:00:20 +0100, Petr Kulhavy wrote:
> linuxptp now pulls in the time-sync.target
> phc2sys (linuxptp-system-clock.service) starts after ptp4l (linuxptp.service)
> 
> Signed-off-by: Petr Kulhavy <brain@jikos.cz>
> ---
>  package/linuxptp/linuxptp-system-clock.service | 2 +-
>  package/linuxptp/linuxptp.service              | 2 ++
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/package/linuxptp/linuxptp-system-clock.service b/package/linuxptp/linuxptp-system-clock.service
> index 7327254..a4436a3 100644
> --- a/package/linuxptp/linuxptp-system-clock.service
> +++ b/package/linuxptp/linuxptp-system-clock.service
> @@ -1,6 +1,6 @@
>  [Unit]
>  Description=Precision Time Protocol system clock synchronization
> -After=syslog.target network.target
> +After=linuxptp.service
>  
>  [Service]
>  ExecStart=/usr/sbin/phc2sys -s /dev/ptp0 -c CLOCK_REALTIME -w -S 1.0
> diff --git a/package/linuxptp/linuxptp.service b/package/linuxptp/linuxptp.service
> index f690430..14e9814 100644
> --- a/package/linuxptp/linuxptp.service
> +++ b/package/linuxptp/linuxptp.service
> @@ -1,6 +1,8 @@
>  [Unit]
>  Description=Precision Time Protocol daemon
>  After=syslog.target network.target
> +Before=time-sync.target
> +Wants=time-sync.target
>  Wants=linuxptp-system-clock.service
>  
>  [Service]

I'm not knowledgeable enough in systemd stuff to decide on this one.
Anyone with more systemd knowledge ?

Thomas
Petr Kulhavy Jan. 30, 2018, 10:19 p.m. UTC | #2
Hi Thomas,

The Before= and Wants=  time-sync.target is what I found in the systemd 
documentation. A time synchronization service should pull in this 
special target, so that applications needing time synchronization can 
depend on it.
Other time synchronizing services like ntpd or systemd-timesyncd use the 
same mechanism.

Cheers
Petr

On 30/01/18 23:00, Thomas Petazzoni wrote:
> Hello,
>
> On Sun, 28 Jan 2018 17:00:20 +0100, Petr Kulhavy wrote:
>> linuxptp now pulls in the time-sync.target
>> phc2sys (linuxptp-system-clock.service) starts after ptp4l (linuxptp.service)
>>
>> Signed-off-by: Petr Kulhavy <brain@jikos.cz>
>> ---
>>   package/linuxptp/linuxptp-system-clock.service | 2 +-
>>   package/linuxptp/linuxptp.service              | 2 ++
>>   2 files changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/package/linuxptp/linuxptp-system-clock.service b/package/linuxptp/linuxptp-system-clock.service
>> index 7327254..a4436a3 100644
>> --- a/package/linuxptp/linuxptp-system-clock.service
>> +++ b/package/linuxptp/linuxptp-system-clock.service
>> @@ -1,6 +1,6 @@
>>   [Unit]
>>   Description=Precision Time Protocol system clock synchronization
>> -After=syslog.target network.target
>> +After=linuxptp.service
>>   
>>   [Service]
>>   ExecStart=/usr/sbin/phc2sys -s /dev/ptp0 -c CLOCK_REALTIME -w -S 1.0
>> diff --git a/package/linuxptp/linuxptp.service b/package/linuxptp/linuxptp.service
>> index f690430..14e9814 100644
>> --- a/package/linuxptp/linuxptp.service
>> +++ b/package/linuxptp/linuxptp.service
>> @@ -1,6 +1,8 @@
>>   [Unit]
>>   Description=Precision Time Protocol daemon
>>   After=syslog.target network.target
>> +Before=time-sync.target
>> +Wants=time-sync.target
>>   Wants=linuxptp-system-clock.service
>>   
>>   [Service]
> I'm not knowledgeable enough in systemd stuff to decide on this one.
> Anyone with more systemd knowledge ?
>
> Thomas
Arnout Vandecappelle Oct. 21, 2018, 11:19 p.m. UTC | #3
On 30/01/2018 22:19, Petr Kulhavy wrote:
> Hi Thomas,
>
> The Before= and Wants=  time-sync.target is what I found in the systemd
> documentation. A time synchronization service should pull in this special
> target, so that applications needing time synchronization can depend on it.
> Other time synchronizing services like ntpd or systemd-timesyncd use the same
> mechanism.

 I double-checked this and confirm. So I've extended the commit log a little and
applied to master, thanks.

 Sorry that it took so long...


 Regards,
 Arnout


> Cheers
> Petr
>
> On 30/01/18 23:00, Thomas Petazzoni wrote:
>> Hello,
>>
>> On Sun, 28 Jan 2018 17:00:20 +0100, Petr Kulhavy wrote:
>>> linuxptp now pulls in the time-sync.target
>>> phc2sys (linuxptp-system-clock.service) starts after ptp4l (linuxptp.service)
>>>
>>> Signed-off-by: Petr Kulhavy <brain@jikos.cz>
>>> ---
>>>   package/linuxptp/linuxptp-system-clock.service | 2 +-
>>>   package/linuxptp/linuxptp.service              | 2 ++
>>>   2 files changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/package/linuxptp/linuxptp-system-clock.service
>>> b/package/linuxptp/linuxptp-system-clock.service
>>> index 7327254..a4436a3 100644
>>> --- a/package/linuxptp/linuxptp-system-clock.service
>>> +++ b/package/linuxptp/linuxptp-system-clock.service
>>> @@ -1,6 +1,6 @@
>>>   [Unit]
>>>   Description=Precision Time Protocol system clock synchronization
>>> -After=syslog.target network.target
>>> +After=linuxptp.service
>>>     [Service]
>>>   ExecStart=/usr/sbin/phc2sys -s /dev/ptp0 -c CLOCK_REALTIME -w -S 1.0
>>> diff --git a/package/linuxptp/linuxptp.service
>>> b/package/linuxptp/linuxptp.service
>>> index f690430..14e9814 100644
>>> --- a/package/linuxptp/linuxptp.service
>>> +++ b/package/linuxptp/linuxptp.service
>>> @@ -1,6 +1,8 @@
>>>   [Unit]
>>>   Description=Precision Time Protocol daemon
>>>   After=syslog.target network.target
>>> +Before=time-sync.target
>>> +Wants=time-sync.target
>>>   Wants=linuxptp-system-clock.service
>>>     [Service]
>> I'm not knowledgeable enough in systemd stuff to decide on this one.
>> Anyone with more systemd knowledge ?
>>
>> Thomas
>
>
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
>
diff mbox series

Patch

diff --git a/package/linuxptp/linuxptp-system-clock.service b/package/linuxptp/linuxptp-system-clock.service
index 7327254..a4436a3 100644
--- a/package/linuxptp/linuxptp-system-clock.service
+++ b/package/linuxptp/linuxptp-system-clock.service
@@ -1,6 +1,6 @@ 
 [Unit]
 Description=Precision Time Protocol system clock synchronization
-After=syslog.target network.target
+After=linuxptp.service
 
 [Service]
 ExecStart=/usr/sbin/phc2sys -s /dev/ptp0 -c CLOCK_REALTIME -w -S 1.0
diff --git a/package/linuxptp/linuxptp.service b/package/linuxptp/linuxptp.service
index f690430..14e9814 100644
--- a/package/linuxptp/linuxptp.service
+++ b/package/linuxptp/linuxptp.service
@@ -1,6 +1,8 @@ 
 [Unit]
 Description=Precision Time Protocol daemon
 After=syslog.target network.target
+Before=time-sync.target
+Wants=time-sync.target
 Wants=linuxptp-system-clock.service
 
 [Service]