- This is a simple Python script for automatically turning on and off the Palworld Windows server.
- When the PalWorld server is not running, it automatically starts when a user attempts to connect.
- When the PalWorld server is running and there are no online users, it automatically shuts down after a certain period.
- Provides an Admin Page through the Webserver to turn the server on and off.
- This tool is a script created for personal use and is currently in development. It is not well-coded and may have many bugs.
- Only supports Windows environment.
- Tested only on small-scale servers.
- Be cautious as unknown security issues may arise.
If you want to try it out, follow the steps below. As of January 28, 2024, it works correctly with PalWorld v0.1.3.0.
To use RCON, set RCONEnabled=True in the PalWorldSettings.ini file.
This file is created when the server is first run and is located at {PalServerPath}\PalServer\Pal\Saved\Config\WindowsServer\PalWorldSettings.ini. If the file is empty, paste the contents of {PalServerPath}\PalServer\DefaultPalWorldSettings.ini into PalWorldSettings.ini.
Download the code from this repository using the "Download ZIP" feature or execute the following command:
git clone https://github.com/nomomo/PalWorld-Dedicated-Server-Auto-Start-Stop.gitThis script has been tested with Python 3.10. To install dependencies, execute the following command in the command prompt:
pip install flask psutil schedule git+https://github.com/ttk1/py-rcon.gitModify the src\settings.json file according to your server settings.
For the palworldExePath, enter the path to {PalServerPath}\PalServer\PalServer.exe.
{
// PalWorld
"palworldExePath": "C:\\steamcmd\\steamapps\\common\\PalServer\\PalServer.exe", //PalWorld Server exe file
"palworldServerIP": "0.0.0.0", // PalWorld Server IP. This is used for "Auto Start". Use "0.0.0.0" to open to all. use "localhost"
"palworldServerPort": 8211, // PalWorld Server PublicPort in PalWorldSettings.ini. This is used for "Auto Start".
"palworldRCONHost": "localhost", // RCON host. use "0.0.0.0" to open to all. use "localhost".
"palworldRCONPort": 25575, // RCONPort in PalWorldSettings.ini. Default is 25575
"palworldAdminPassword": "topSecretPassword", // AdminPassword in PalWorldSettings.ini
// Web Server
"useWebServer": true, // Use simple admin page
"webServerHost": "localhost", // webserver hostname. use "0.0.0.0" to open to all. use "localhost"
"webServerPort": 8212, // webserver port
"showAction": true, // show action area
"showServerOnBtn": true, // show "Server On" button
"showServerOffBtn": true, // show "Server Off" button
"showUpdateServerStatusBtn": true, // show "Update Server Status" button
"showServerIPAddress": true, // show IP Address
// Auto Start
"useAutoStart": true, // when user try to access, start the server automatically
// Auto Stop
"useAutoStop": true, // if True && there is are no players online, server will automatically stop
"ServerAutoStopSeconds": 600.0, // the server will automatically stop after ServerAutoStopSeconds seconds.
"ServerAutoStopCheckInterval": 10.0, // AutoStop event is checked every ServerAutoStopCheckInterval seconds.
"palworldMainProcessName": "PalServer-Win64-Shipping-Cmd.exe" // don't change, if there is no problem
}Navigate to the src folder in the command prompt and execute the following command:
python main.pyThe console window is automatically on and the log is printed. The log is written in the app.log file.
If "useWebServer": True is set in the configuration, check if the Admin Page is accessible. The default URL is http://localhost:8212/.
- The ShowPlayers command does not work in RCON Commands if the user's nickname contains Unicode characters. This error occurs because the number of characters received that should be read differs from the number of characters actually received.
- Workaround: Open the connection.py file installed with the py-rcon package and modify the contents of the _read function as follows:
def _read(self, length):
packet_data = self.sock.recv(length)
if len(packet_data) < length:
#raise Exception('Received few bytes!') # disable raise exception
return packet_data
return packet_data- When the PalWorld server is not running, it opens port 8211 to receive packets.
- It waits for a packet starting with
\x09\x08\x00. - Once the packet is received, it closes port 8211 and executes the file located at
palworldExePathto start the server.
- It checks the number of players currently on the server through RCON (
ShowPlayerscommand). - If the number of players is 0, it uses RCON to gracefully shut down the server with the
Shutdowncommand.
Timing uncertain:
- Code cleanup
- Support for pip install
- Beautify the Admin page
- Automatically restart the server at regular intervals. Notify in advance through server messages before restarting.
- Auto backup
- IP Blacklist
- Changed to edit settings.json instead of settings.py file for settings
- Fixed an issue where UDT connections were terminated when random packets were input to the socket.
- Initial commit
MIT

