Example: How to send a command. - njb-said/Godfrey GitHub Wiki
Preface
Please read the Packet Spec wiki page for additional information regarding the general layout of packets sent/received.
Packet type is: COMMANDREQUEST
Via Web Interface (Recommended)
Coming Soon
How to send a command to a specific server
To send a command you will need to publish data to the redis channel godfrey-comms
in JSON format.
The JSON object must consist of the following:
- A
hostname
, this is the hostname of the target server where you want the command to run. - A
data
, a json object which has the command you want to send and a unique identifier (normally the command and a timestamp for when you requested the command, hashed with md5 is good)
As mentioned above you will need to put command
and hashId
into the data
object. The server will then run the command and publish what the command outputs in shell back to you in the response line packet.
How to send a command to all servers
Warning: This feature is recommended for advanced users only.
To send a command to all servers you will need to publish data to the redis channel godfrey-comms
in JSON format.
The JSON object must consist of the following:
- A
hostname
, this must be an asterisk (*) - A
data
, a json object which has the command you want to send and a unique identifier (normally the command and a timestamp for when you requested the command, hashed with md5 is good)
As mentioned above you will need to put command
and hashId
into the data
object. The servers will then each run the command and publish what the command outputs in shell back to you in the response line packet.