How to phrase protobuf command to gateway bridge

I’ve been trying to use mosquitt_pub to send a reboot command to a gateway. I had this figured when the marshaler in /etc/chirpstack-gateway-bridge/chirpstack-gateway-bridge.toml is set to json, not protobuf. However, I have a gateway deployed in the field where I forgot to change this configuration (all other aspects of the configuration are correct and working). I was wondering how to phrase the same message I had with a json message in protobuf. The original message is as such:

mosquitto_pub -t “gateway/{{ Gateway ID }}/command/exec” -f mqtt.json --debug

mqtt.json:

{
“gatewayID”:" “(( base64 encrypted gateway ID ))”,
“command”:“reboot”,
“token”: “EA==”
}

I’ve read that I should use the GatewayCommandExecRequest message from gw.proto but not sure exactly how to approach that.

Please see https://github.com/brocaar/chirpstack-api, which contains the Protobuf files + some language implementations. https://developers.google.com/protocol-buffers/docs/tutorials might also be helpful.

1 Like

@brocaar what is the command the sudo command to restart the gateway. e.g. sudo restart…?

More specifically what is the command I can put into this command paramater:


in order the restart the gateway bridge, not reboot.

Please let me know. Thank you.

If you configure [commands.commands.reboot] then reboot is the command that must be referenced within the Protobuf message (e.g. it is the label referencing this command config).

The command="reboot" in the chirpstack-gateway-bridge.toml file must point to an executable that will be executed. E.g.

[commands.commands.update]
max_execution_duration="90s"
command="/path/to/update/script.sh"

In which case when you send the update command to the ChirpStack Gateway Bridge, it will execute the /path/to/update/script.sh :slight_smile: