Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/woozymasta/bercon
bercon is the command line interface for the BattlEye RCON protocol for Linux and Windows
https://github.com/woozymasta/bercon
arma arma3 battleye battleye-rcon cli dayz rcon rcon-client rcon-console
Last synced: 19 days ago
JSON representation
bercon is the command line interface for the BattlEye RCON protocol for Linux and Windows
- Host: GitHub
- URL: https://github.com/woozymasta/bercon
- Owner: WoozyMasta
- License: mit
- Created: 2024-03-13T18:28:49.000Z (8 months ago)
- Default Branch: master
- Last Pushed: 2024-03-14T12:17:38.000Z (8 months ago)
- Last Synced: 2024-10-05T08:41:01.842Z (about 1 month ago)
- Topics: arma, arma3, battleye, battleye-rcon, cli, dayz, rcon, rcon-client, rcon-console
- Language: Rust
- Homepage: https://woozymasta.github.io/bercon
- Size: 431 KB
- Stars: 7
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# bercon
![logo][]
`./bercon` is the command line interface for the **BattlEye RCON** protocol
> [!NOTE]
> This document is available in the languages:
> [eng π¬π§][], [cz π¨πΏ][], [rus π·πΊ][], [ua πΊπ¦][]## Description
`bercon` provides a convenient way to interact with the server using the
BattlEye RCON (Remote Console) protocol.
This tool allows you to execute various commands,
control the server, and track responses from the server.It is suitable for such servers as Arma2, Arma3, DayZ, etc. using the
protocol [BERConProtocol][], with a full list of games you can
check out the full list of games on the [BattlEye][] website## Installation
You can download the latest version of the programme by following the links
[Linux] or [Windows]For Linux you can also use the command
```bash
curl -#SfLo /usr/bin/bercon \
https://github.com/WoozyMasta/bercon/releases/latest/download/bercon
chmod +x /usr/bin/bercon
bercon -h && bercon -V
```Or do the build yourself
```bash
git clone https://github.com/WoozyMasta/bercon
cd bercon
cargo build
```## Parameters
```txt
BattlEye RCON CLIUsage: bercon [OPTIONS] --password
Commands:
cli Open interactive CLI
exec Execute a command (e.g. commands or players)
listen Listen for server responses
help Print this message or the help of the given subcommand(s)Options:
-i, --ip Server IPv4 address [env: BERCON_IP=] [default: 127.0.0.1]
-p, --port Server UDP port [env: BERCON_PORT=] [default: 2305]
-P, --password Password [env: BERCON_PASSWORD]
-t, --timeout Timeout in seconds [env: BERCON_TIMEOUT=] [default: 45]
-k, --keepalive Keepalive in seconds [env: BERCON_KEEPALIVE=] [default: 30]
-d, --debug Print debug messages and data
-h, --help Print help
-V, --version Print version
```> [!NOTE]
> If the timeout is set to less than the connection control,
> then the connection control value will also change to the set value.
> Connection control cannot be set for more than 45 seconds,
> because it makes no sense, and all larger values will be set to 45 seconds.## Usage Examples
You can use arguments, variables, or a combination of both
```bash
bercon -p 2306 -P myPass exec players
BERCON_PASSWORD=myPass BERCON_PORT=2306 bercon exec players
BERCON_PASSWORD=myPass bercon -p 2306 exec players
```The argument value has the highest priority over the environment variable
```bash
# pas$$word will be used
BERCON_PASSWORD='strong' bercon -P 'pas$$word' exec players
```Don't forget to use inverted commas, as passwords and commands may contain
command line control characters.
When you use arguments with `-`,
such as `say -1`, you should specify `--` to tell the program,
that the argument analysis is complete```bash
bercon --ip 192.168.0.10 --port 2306 --password 'pas$$word' exec -- '#lock'
bercon -i 192.168.0.10 -p 2306 -P 'pas$$word' exec -- '#unlock'
bercon -t1 -i 192.168.0.10 -p 2306 -P 'pas$$word' exec -- say -1 'Hello world!'
```## Additional linux examples
You can also use variables to store parameters for
different servers in different files```bash
# in the ~/.server-1.env file
BERCON_IP=192.168.0.10
BERCON_PORT=2306
BERCON_PASSWORD='pas$$word'.# read the file and execute the command
. .server-1.env && bercon exec players
```An example function that will allow you to execute commands on several of your
DayZ servers at the same time> [!TIP]
> Functions can be placed in `~/.bashrc` for quick access to them```bash
export DAYZ_SERVERS_COUNT=5dayz-all-rcon() {
for i in $(seq 1 "$DAYZ_SERVERS_COUNT"); do
printf '[%s] ' "Server-$i"
. "~/.server-$i.env".
bercon -t1 exec -- "$1";
echo
done
}# show players on all servers
dayz-all-rcon players
# ban GUIDs permanently on all servers
dayz-all-rcon addBan "$GUID" 0 cheater
```This example will allow you to conveniently perform a delayed restart on all
DayZ servers at the same time, notifying players that a restart is imminent> [!TIP]
> This example recycles the function from the previous example```bash
dayz-all-restart() {
local timer="${1:-120}" step="${2:-10}"
dayz-all-rcon '#lock'
dayz-all-rcon say -1 "Server locked for new connection, restart after $timer seconds"
for i in $(seq "$timer" "-$step" 0); do
sleep "$step"
dayz-all-rcon say -1 "Restart server after $timer seconds"
done
dayz-all-rcon '#shutdown'
}# restart all servers after 120 (default) seconds
dayz-all-restart
# restart all servers after 360 seconds
dayz-all-restart 360
```> [!CAUTION]
> At the time of writing, the modified version of the DayZ server for Linux
> has a problem with server stopping ([T179734]), you may need to additionally
> monitor the state of the process. As one solution for example
> script [DayZ Linux Server watchdog]With this example, you can stop and shut down all DayZ servers
before maintaining your server> [!TIP]
> This example utilises the function from the previous example```bash
dayz-all-shutdown() {
dayz-all-restart "${1:-120}" "${2:-10}"
for i in $(seq 1 "$DAYZ_SERVERS_COUNT"); do
systemctl --user stop "dayz-server@$i.service" &
systemctl --user disable "dayz-server@$i.service"
done
wait
}# shutdown all servers after 360 seconds
dayz-all-shutdown 360
```[eng π¬π§]: README.md
[ua πΊπ¦]: docs/README.ua.md
[rus π·πΊ]: docs/README.ru.md
[cz π¨πΏ]: docs/README.cz.md
[logo]: assets/logo.png[Linux]: "Linux x86 gcc binary"
[Windows]: "Windows exe file"
[BattlEye]: "BattlEye β The Anti-Cheat Gold Standard"
[BERConProtocol]: "BattlEye RCON Protocol Specification"
[T179734]: https://feedback.bistudio.com/T179734 "linux modded server shutdown bug"
[DayZ Linux Server watchdog]: https://gist.github.com/WoozyMasta/3c3aaf8d1b1517e9ee47c6b2a96fee96 "DayZ Linux Server watchdog"