GreenGrassV2, start or stop wpa_supplicant@wlan0.service from lambda

0

Environment : GreenGrassV2,

Deployed on : Raspberry Pi Version 3 ,

Operating system :** Raspbian GNU/Linux 10**

We want to start and stop raspberry pi operating system's service from lambda function. Lambda function is deployed under green grass container.

Service can be start and stop without sudo / root privileges. We have configured polkit service to start/stop service without sudo.

To start and stop service we tried with "exec" , "spawn" and "spawnSync" but we are getting error as under

{"err":{"killed":false, "code":1,"signal":null,"cmd":"systemctl stop wpa_supplicant@wlan0.service"}}

We also tried to execute command using .sh file but that also giving above error.

Purpose to start/stop service is, we want to change Raspberry pi AP mode to station mode and vise versa.

已提問 2 年前檢視次數 243 次
2 個答案
1
已接受的答案

Hello,

Greengrass Lambdas use container technology for process isolation and reduced security concerns. I highly suspect that you won't be able to run this command from within the container and have it work. You can switch your lambda to run without a container such that it is just running a process directly on the hardware in the same way that you would run a process on the commandline.

When changing from container to non-container you will create a new Greengrass component from the lambda and select non-container mode. When deploying this updated Greengrass component version to the device you must edit the configuration update options in order to set the configuration on the device to use the new values. Specify "RESET": [""] to reset all configuration for the component to the new values. Learn more about reseting configuration here: https://docs.aws.amazon.com/greengrass/v2/developerguide/update-component-configurations.html#reset-configuration-update

AWS
專家
已回答 2 年前
0

Thanks Michael,

Problem solved with non-container and "RESET": [""] parameter.

Thanks a lot.

已回答 2 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南