You've already forked OpenIntegrations
mirror of
https://github.com/Bayselonarrend/OpenIntegrations.git
synced 2025-11-23 22:05:15 +02:00
77 lines
2.3 KiB
Plaintext
Vendored
77 lines
2.3 KiB
Plaintext
Vendored
---
|
|
sidebar_position: 2
|
|
description: Execute command and other functions to work with RCON in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
|
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, RCON]
|
|
---
|
|
|
|
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 = "12We...";
|
|
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 \
|
|
--exec "list" \
|
|
--conn "{'url':'127.0.0.1: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 ^
|
|
--exec "list" ^
|
|
--conn "{'url':'127.0.0.1:25575','password':'***','read_timeout':'20','write_timeout':'20'}"
|
|
```
|
|
</TabItem>
|
|
</Tabs>
|
|
|
|
|
|
```json title="Result"
|
|
{
|
|
"data": "There are 0 of a max of 20 players online: ",
|
|
"result": true
|
|
}
|
|
```
|