Like WFS... I also created a systemd service so that I could add the  
Requires=time-sync.target, which worked to delay the start but then caused 
problems during upgrading of weewx with apt.  So I figured out how to do 
this with the default init.d script.

1.  $sudo systemctl enable systemd-time-wait-sync
2.  Add time-sync.target to your default /etc/init.d/weewx script like I 
show below.

### BEGIN INIT INFO
# Provides:          weewx
# Required-Start:    $local_fs $remote_fs $syslog systemd-time-wait-sync

3.   $sudo systemctl daemon-reload

Works exactly like you want and no problems during upgrade.  

On Tuesday, February 9, 2021 at 8:21:23 a.m. UTC-8 [email protected] 
wrote:

> Thanks for your Feedback!
> I will try this method with systemd in near future.
> Greetings 
> Plinepa
>
>
> [email protected] <[email protected]> schrieb am So., 7. Feb. 2021, 15:48:
>
>> Thanks for pointing this out.  It looks like it is working for me.  I 
>> switched over to systemd control of weewx following the directions in the 
>> Wiki: systemd <https://github.com/weewx/weewx/wiki/systemd>,  and I had 
>> to enable the systemd-time-wait-sync service on my Pi: ($sudo systemctl 
>> enable systemd-time-wait-sync).  I shut down my Pi and turned off my 
>> network, waited a few minutes, booted the Pi without the network, waited 
>> another couple of minutes, then turned on the network.  The log shows Weewx 
>> did not start until the time was updated to the correct time.  Partial log 
>> attached.
>>
>> One new message I haven't seen before:
>> Feb  7 07:56:27 raspberrypi2 systemd[1]: weewx.service: Supervising 
>> process 598 which is not our child. We'll most likely not notice when it 
>> exits.
>>
>> I am on Raspbian GNU/Linux 10 (buster).  Weewx is about the only real 
>> work my Pi does.  I guess there is a question about holding up other 
>> processes too when you enable time-wait-sync.
>>
>> I did omit the Requires=time-sync.target command in the service file 
>> based on the comment in the Stackexchange link ("...use After= but don't 
>> "Pull it in".).
>>
>> Walt
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/9caa7623-0667-4d17-a0c3-10f86709152en%40googlegroups.com.

Reply via email to