zerotier/ZeroTierOne

zerotier-one should support systemd notification

Open

#2,277 建立於 2024年4月27日

在 GitHub 查看
 (3 留言) (1 反應) (0 負責人)C++ (1,558 fork)batch import
Good First IssueLinuxType: Enhancement

倉庫指標

Star
 (12,761 star)
PR 合併指標
 (平均合併 265天 19小時) (30 天內合併 1 個 PR)

描述

Here's the problem:

$ sudo systemctl start zerotier-one && sudo zerotier-cli info
Error connecting to the ZeroTier service: connection failed

Please check that the service is running and that TCP port 9993 can be contacted via 127.0.0.1.

systemctl start will wait until a service is ready before returning - which is essential to avoid race conditions when installing and configuring zerotier from a script. However this only works for Type=notify services. Otherwise a small sleep is required, which is needlessly pessimistic when the zerotier-one service is already running.

ZeroTier One should support systemd notification so that it can notify systemd when it has bound to its control interface and is ready to accept commands.

Implementing notification is simple: if the NOTIFY_SOCKET env var is set, open a datagram socket and write READY=1 once the service has finished booting.

I've had a quick look at the code, and I think here would be the right place to insert the ready notification.

貢獻者指南