请与SD_BU核实如果重新加载过程成功
我正在尝试使用SD_BUS_GET_PROPERTY()检查(例如Nginx或PHP成功)。
为此,属性“激活”和“取代”很有趣。
但是,例如,如果我故意在nginx.conf中犯了一个错误,然后尝试重新加载nginx,我会得到以下状态:
...
Active_state:重新加载
sub_state:重新加载
Active_state:重新加载
sub_state:重新加载
Active_state:重新加载
sub_state:重新加载
Active_State:Active
sub_state:运行
因此,如果nginx处于活动状态并运行,则在失败的重新加载后,状态就可以回到“活动”和“运行”。
是否有一种方法可以安全检查,如果重新加载失败?
谢谢!
i'm trying to check with sd_bus_get_property() if reloading for example nginx or php was successfull.
For that the properties "ActiveState" and "SubState" are interesting.
But if i for example intentionally make a mistake in the nginx.conf and try to reload nginx, i get the following states:
...
ACTIVE_STATE: reloading
SUB_STATE: reload
ACTIVE_STATE: reloading
SUB_STATE: reload
ACTIVE_STATE: reloading
SUB_STATE: reload
ACTIVE_STATE: active
SUB_STATE: running
So if nginx is active and running, after the failed reload the states just get back to "active" and "running".
Is there a way to safely check, if the reload fails?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我最终以不同的方式管理这些过程:
作为NGINX和PHP-FPM的示例:
nginx:
工人处理。
失败的。
php-fpm:
php-fpm上似乎更容易,因为php-fpm将“ ActiveState”设置为“失败”,如果重新加载失败。
我以为我只是可以等待状态“重新加载”之后的“激活”更改,但是如果重新加载失败,则php-fpm将状态首先设置为“ Active”,然后将其恢复为“ Active”,然后快速到“失败”。
因此,我还等待PHP-FPM 200-300ms,然后检查状态。
如果有人有更好的主意,请告诉我...谢谢!
I ended up managing the processes differently:
As an example for Nginx and PHP-FPM:
Nginx:
Worker-Processes.
failed.
PHP-FPM:
On PHP-FPM it seems easier, as PHP-FPM sets the "ActiveState" to "failed" if reloading fails.
I thought i just could wait for a change of the "ActiveState" after the State is "reloading", but if reloading fails, php-fpm sets the State first back to "active" an then quickly to "failed".
Therefore i wait also for PHP-FPM 200-300ms and then check the State.
If someone has a better idea, please tell me... Thanks!