Executes CLI command on remote node.

Preliminary stages:

  1. Find out public key of the node, from which EXEC_CMD will be requested. This can be done by using the following command in the cellframe-node-tool:
cellframe-node-tool cert pkey show node-addr
  1. On the node, which is going to receive requests, make some changes in the [[Cellframe Node General Config#Section [server]|cellframe node configuration]].
[server]
enabled=true
exec_cmd=[pkey from previous step]
  1. The node, which is going to receive requests, must be in the node list.

  2. Restart the node after making changes in the config.

CLI Example

Command syntax:

exec_cmd 
-net <net_name> 
-addr <node_addr> 
-cmd <command,and,all,args,separated,by,commas>

Options:

-net - name of the Cellframe Network. The list of networks can be found in the <Config_dir> \ etc \ network folder or received by The Cellframe-Node-CLI using command - net list
-addr - address of the node
-cmd - command including all arguments separated by commas

Command:

(cellframe-node-cli get status -net raiden)

cellframe-node-cli exec_cmd 
-net raiden 
-cmd net,-net,raiden,get,status 
-addr C5BF::79BA::CC16::8D7C

Response:

        type: 2
        result:
 
                status:
                    net: raiden
                    current_addr: C5BF::79BA::CC16::8D7C
                    links:
                        active: 4
                        required: 3
 
                    processed:
                        zerochain:
                            status: synced
                            current: 760
                            in network: 760
                            percent: 100.000 %
 
                        main:
                            status: synced
                            current: 52517
                            in network: 52517
                            percent: 100.000 %
 
 
                    states:
                        current: NET_STATE_ONLINE
                        target: NET_STATE_ONLINE
 
 
        id: 0

JSON-RPC Example

Command:

curl --unix-socket /opt/cellframe-node/var/run/node_cli 
-X POST http://localhost/connect 
-d '{"method":"exec_cmd", "params":["exec_cmd;-net;raiden;-cmd;net,-net,raiden,get,status;-addr;C5BF::79BA::CC16::8D7C"], "id":"1"}'

Response:

{
  "type"2,
  "result": [
    {
      "type"2,
      "result": [
        {
          "status": {
            "net""raiden",
            "current_addr""C5BF::79BA::CC16::8D7C",
            "links": {
              "active"4,
              "required"3
            },
            "processed": {
              "zerochain": {
                "status""synced",
                "current"760,
                "in network"760,
                "percent""100.000 %"
              },
              "main": {
                "status""synced",
                "current"52517,
                "in network"52517,
                "percent""100.000 %"
              }
            },
            "states": {
              "current""NET_STATE_ONLINE",
              "target""NET_STATE_ONLINE"
            }
          }
        }
      ],
      "id"0
    }
  ],
  "id"1
}