Running as a Service
Run your Hytale server as a system service for automatic startup, crash recovery, and easier management.
Linux (systemd)
Section titled “Linux (systemd)”Create Service File
Section titled “Create Service File”Create /etc/systemd/system/hytale.service:
[Unit]Description=Hytale ServerAfter=network.target
[Service]User=hytaleWorkingDirectory=/opt/hytaleExecStart=/usr/bin/java -Xms4G -Xmx4G -jar HytaleServer.jar --assets ../HytaleAssetsRestart=on-failureRestartSec=10StandardOutput=journalStandardError=journal
[Install]WantedBy=multi-user.targetConfiguration Options
Section titled “Configuration Options”| Option | Description |
|---|---|
User | System user to run the server as |
WorkingDirectory | Server installation directory |
Restart=on-failure | Auto-restart on crashes |
RestartSec=10 | Wait 10 seconds before restart |
Service Commands
Section titled “Service Commands”# Enable service to start on bootsudo systemctl enable hytale
# Start the serversudo systemctl start hytale
# Stop the serversudo systemctl stop hytale
# Restart the serversudo systemctl restart hytale
# Check statussudo systemctl status hytaleView Logs
Section titled “View Logs”# Follow live logssudo journalctl -u hytale -f
# View last 100 linessudo journalctl -u hytale -n 100
# View logs since bootsudo journalctl -u hytale -b
# View logs from specific timesudo journalctl -u hytale --since "2024-01-01 00:00:00"Advanced systemd Configuration
Section titled “Advanced systemd Configuration”For production servers with optimized JVM:
[Unit]Description=Hytale ServerAfter=network.targetWants=network-online.target
[Service]User=hytaleGroup=hytaleWorkingDirectory=/opt/hytaleExecStart=/usr/bin/java \ -Xms8G -Xmx8G \ -XX:+UseG1GC \ -XX:+ParallelRefProcEnabled \ -XX:MaxGCPauseMillis=200 \ -jar HytaleServer.jar \ --assets ../HytaleAssets
# Security hardeningNoNewPrivileges=truePrivateTmp=trueProtectSystem=strictProtectHome=trueReadWritePaths=/opt/hytale
# Resource limitsLimitNOFILE=65536
# Restart behaviorRestart=on-failureRestartSec=10StartLimitIntervalSec=300StartLimitBurst=5
StandardOutput=journalStandardError=journalSyslogIdentifier=hytale
[Install]WantedBy=multi-user.targetWindows Service
Section titled “Windows Service”Using NSSM (Non-Sucking Service Manager)
Section titled “Using NSSM (Non-Sucking Service Manager)”-
Download NSSM from nssm.cc
-
Install the service:
nssm install HytaleServer "C:\Program Files\Java\jdk-25\bin\java.exe"nssm set HytaleServer AppParameters "-Xms4G -Xmx4G -jar HytaleServer.jar --assets ..\HytaleAssets"nssm set HytaleServer AppDirectory "C:\hytale-server"- Configure logging:
nssm set HytaleServer AppStdout "C:\hytale-server\logs\stdout.log"nssm set HytaleServer AppStderr "C:\hytale-server\logs\stderr.log"nssm set HytaleServer AppRotateFiles 1nssm set HytaleServer AppRotateBytes 10485760- Start the service:
nssm start HytaleServerNSSM Commands
Section titled “NSSM Commands”# Start servicenssm start HytaleServer
# Stop servicenssm stop HytaleServer
# Restart servicenssm restart HytaleServer
# Check statusnssm status HytaleServer
# Edit service configurationnssm edit HytaleServer
# Remove servicenssm remove HytaleServer confirmUsing Windows Task Scheduler
Section titled “Using Windows Task Scheduler”For simpler setups, use Task Scheduler:
- Open Task Scheduler
- Create Basic Task
- Set trigger to “When the computer starts”
- Action: Start a program
- Program:
C:\Program Files\Java\jdk-25\bin\java.exe - Arguments:
-Xms4G -Xmx4G -jar HytaleServer.jar --assets ..\HytaleAssets - Start in:
C:\hytale-server
Docker (Optional)
Section titled “Docker (Optional)”Basic Dockerfile
Section titled “Basic Dockerfile”FROM eclipse-temurin:25-jre
WORKDIR /server
COPY HytaleServer.jar .COPY HytaleAssets ../HytaleAssets
EXPOSE 5520/udp
CMD ["java", "-Xms4G", "-Xmx4G", "-jar", "HytaleServer.jar", "--assets", "../HytaleAssets"]Docker Compose
Section titled “Docker Compose”version: '3.8'services: hytale: build: . ports: - "5520:5520/udp" volumes: - ./universe:/server/universe - ./config.json:/server/config.json - ./mods:/server/mods restart: unless-stopped environment: - JAVA_OPTS=-Xms4G -Xmx4GBest Practices
Section titled “Best Practices”- Use dedicated user - Don’t run as root/Administrator
- Enable auto-restart - Recover from crashes automatically
- Configure logging - Rotate logs to prevent disk fill
- Set resource limits - Prevent runaway memory usage
- Monitor the service - Use monitoring tools for alerts