Set the right target-state

Hello,

I m trying to use the set target-state command to run 2 services. Before run the command i already run one service. Inside the set target-state command i have the service that already running plus one more service (this service is stored to images) . The problem is that when i run the set target state command, the first service is running ok and the second is restarted all the time. The container of second service is created, is up for very few seconds(2 or 3 seconds) and then killed. And this happens all over again.
I use balenaOS 2.38.0+rev1 version, 9.15.7 supervisor version. The target-state command is very big to posted here. Maybe its better to send it in a file.
Before set the target-state command i run these services seperately and by getting the target-state i saw the right arguments to use in set state command.

Thanks

What do you mean by “set target-state command”? Can you enable support access to the device and post the link here?

Sory that i didnt explain with more details…
I mean using the supervisor-api to execute the action :
curl -X POST --header “Content-Type:application/json” “$BALENA_SUPERVISOR_ADDRESS/v2/local/target-state” -d $TARGET_STATE .
The $TARGET_STATE is a json format payload, and has a lot of arguments. (https://github.com/balena-io/balena-supervisor/blob/master/docs/API.md)
After some tests by setting the fields of the json payload , i manage to set the right target-state by pointing 2 services to run after the execution of the set target-state.
So no need to enable support acces for now.

Thanks anyway… :slight_smile:

Glad it worked out and thanks a lot for the bit of clarification of what were you doing! Please note that in that documentation it also says for those endpoints:

These endpoints are mainly for use by the CLI, for working with a local mode device. As such they are not recommended for general use.

Thus it’s still not entirely sure what are you doing, we’d be quite curious how people use the tools we build :slight_smile: