如何从 python 模块中重启 Azure iotedge 服务

How to Restart Azure iotedge service from inside a python module

我正在研究一个解决方案,如果一个问题到达容器内部,我必须重新启动 azure edge 运行time。

一般情况下,重启azure iotedge服务的方法是,运行主机终端中的波纹管命令

sudo ststemctl restart iotedge 

如何在容器内部实现这个?

所以你是 运行 容器中的容器?我从来没有试过这个。虽然这似乎可行,但请注意,它需要授予 docker 额外权限,并且可能会带来安全问题。

Generally, the way to restart the azure iotedge service is, to run the bellow command in the host terminal

你应该能够在容器内执行并做同样的事情吧?

我为这个解决方案找到的解决方案是 - https://docs.microsoft.com/en-us/answers/questions/40541/rebooting-edge-device-remotely.html

我会使用 exit() 让我的模块死掉,这样 iot edge 运行time 会自动重启我的模块。我也会在启动 exit() 之前记录错误。

我想知道是否有理由重启整个边缘 运行time 运行 只是为了从容器中的问题中恢复。