- Download the RCON client from Github
root@vultr:~# cd ~
root@vultr:~# wget https://github.com/gorcon/rcon-cli/releases/download/v0.10.1/rcon-0.10.1-amd64_linux.tar.gz
NOTE: This URL is for example only, find the latest release for your architecture here
- Extract the tar archive in your home directory and rename the folder to
rcon
:
root@vultr:~# tar -xvf rcon-0.10.1-amd64_linux.tar.gz
root@vultr:~# mv rcon-0.10.1-amd64_linux/ rcon/
- Navigate to the directory containing the rcon executable
root@vultr:~# cd rcon/
- Use your preferred text editor to edit the configuration file
root@vultr:~/rcon# nano rcon.yaml
- Use the template below to edit your configuration file, substituting your RCON password. If the game server is on a remote host, change "localhost" to the IP address of the game server. The game server RCON host listens on port 27015 by default, but this can be modified in your server settings.
# rcon.yaml
default:
address: "localhost:27015" # host:port, for example 127.0.0.1:16260
password: "YourSuperSecretRCONPassword"
log: "rcon-default.log"
type: "rcon"
- Run commands on the RCON client by invoking the executable and pointing to the configuration file while providing a command
root@vultr:~# ~/rcon/rcon -c ~/rcon/rcon.yaml 'servermsg "ALERT: This server will be shutting down!"'
You can now execute Project Zomboid server commands directly from a shell script, crontab, etc.
You can use this script to connect to the RCON client directly and run commands. This script waits for the RCON server to start listening on the port specified by RCON_PORT
(default: 27015), since it may take some amount of time for your server to intiialize, download workshop items, etc.