68 lines
1.7 KiB
Markdown
68 lines
1.7 KiB
Markdown
# Hytale Server Systemd Setup
|
|
|
|
## Files
|
|
|
|
| File | Description | Target on Server |
|
|
|------|-------------|------------------|
|
|
| `hytale.service` | Main service for the server | `/etc/systemd/system/` |
|
|
| `hytale-update.sh` | Update script | `/opt/hytale/` |
|
|
| `hytale-update.service` | Service for updates | `/etc/systemd/system/` |
|
|
| `hytale-update.timer` | Timer for daily updates at 4 AM | `/etc/systemd/system/` |
|
|
|
|
## Installation on the Server
|
|
|
|
```bash
|
|
# 1. Copy files
|
|
sudo cp hytale.service /etc/systemd/system/
|
|
sudo cp hytale-update.service /etc/systemd/system/
|
|
sudo cp hytale-update.timer /etc/systemd/system/
|
|
cp hytale-update.sh /opt/hytale/
|
|
chmod +x /opt/hytale/hytale-update.sh
|
|
|
|
# 2. Create log file
|
|
sudo touch /var/log/hytale-update.log
|
|
sudo chown mars3142:mars3142 /var/log/hytale-update.log
|
|
|
|
# 3. Reload systemd
|
|
sudo systemctl daemon-reload
|
|
|
|
# 4. Enable and start server service
|
|
sudo systemctl enable hytale.service
|
|
sudo systemctl start hytale.service
|
|
|
|
# 5. Enable update timer
|
|
sudo systemctl enable hytale-update.timer
|
|
sudo systemctl start hytale-update.timer
|
|
```
|
|
|
|
## Useful Commands
|
|
|
|
```bash
|
|
# Server status
|
|
sudo systemctl status hytale.service
|
|
|
|
# Show server logs
|
|
sudo journalctl -u hytale.service -f
|
|
|
|
# Manually stop/start server
|
|
sudo systemctl stop hytale.service
|
|
sudo systemctl start hytale.service
|
|
sudo systemctl restart hytale.service
|
|
|
|
# Run update manually
|
|
sudo /opt/hytale/hytale-update.sh
|
|
|
|
# Check timer status
|
|
sudo systemctl list-timers | grep hytale
|
|
|
|
# Show update logs
|
|
cat /var/log/hytale-update.log
|
|
```
|
|
|
|
## Notes
|
|
|
|
- The server starts automatically after a reboot
|
|
- Updates are checked daily at 4:00 AM
|
|
- Already applied updates are stored in `/opt/hytale/.applied_updates`
|
|
- When an update is found, the server is automatically stopped, updated, and restarted
|