1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-11-25 22:12:29 +02:00
Files
OpenIntegrations/docs/en/md/RCON/Commands-execution/Execute-command.mdx
Vitaly the Alpaca (bot) 73e1617628 Main build (Jenkins)
2025-03-18 11:35:12 +03:00

84 lines
2.2 KiB
Plaintext
Vendored

---
sidebar_position: 2
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Execute command
Executes the command on the server
`Function ExecuteCommand(Val Command, Val Connection) Export`
| Parameter | CLI option | Type | Required | Description |
|-|-|-|-|-|
| Command | --exec | String | ✔ | Command text |
| Connection | --conn | Arbitrary, Structure Of KeyAndValue | ✔ | Connection or connection parameters |
Returns: Map Of KeyAndValue - Result of command execution
<br/>
:::tip
When passing connection parameters, a new connection will be created and closed within the execution of a single command. To execute several commands (in OS and 1C versions), it is recommended to use a connection created in advance (see CreateConnection)
:::
<br/>
```bsl title="1C:Enterprise/OneScript code example"
URL = "127.0.0.1:25565";
Password = "Jg9F...";
WriteTimeout = 20;
ReadTimeout = 20;
ConnectionParams = OPI_RCON.FormConnectionParameters(URL, Password, ReadTimeout, WriteTimeout);
Connection = OPI_RCON.CreateConnection(ConnectionParams);
Command = "list";
Result = OPI_RCON.ExecuteCommand(Command, Connection);
```
<Tabs>
<TabItem value="bash" label="Bash" default>
```bash
# JSON data can also be passed as a path to a .json file
oint rcon ExecuteCommand \
--url "93.125.42.204:25575" \
--pass "***" \
--wtout 20 \
--rtout 20 \
--exec "list" \
--conn "{'url':'93.125.42.204:25575','password':'***','read_timeout':20,'write_timeout':20}"
```
</TabItem>
<TabItem value="bat" label="CMD/Bat" default>
```batch
:: JSON data can also be passed as a path to a .json file
oint rcon ExecuteCommand ^
--url "93.125.42.204:25575" ^
--pass "***" ^
--wtout 20 ^
--rtout 20 ^
--exec "list" ^
--conn "{'url':'93.125.42.204:25575','password':'***','read_timeout':20,'write_timeout':20}"
```
</TabItem>
</Tabs>
```json title="Result"
{
"data": "There are 0/20 players online:",
"result": true
}
```