# FiveM – Protecting Your Server from Crashes

Fix common errors and debug issues on your Fivem – NexoraHost help.

**Quick answer:** This guide solves a specific server problem step by step – not just theory. For connection, startup or performance issues see troubleshooting below and related guides.

This guide shows you how to keep your FiveM server stable and prevent crashes – from proper configuration to troubleshooting.

## Common crash causes

    - **RAM full:** Too many resources or players for the available RAM
- **Faulty scripts:** Infinite loops, incorrect database queries
- **Outdated resources:** Incompatible with current FiveM version
- **Database not reachable:** MySQL overloaded or crashed

## 1. Set up automatic restart

### Linux (systemd)

`sudo nano /etc/systemd/system/fivem.service

[Unit]
Description=FiveM Server
After=network.target

[Service]
Type=simple
User=fivem
WorkingDirectory=/home/fivem/fxserver/server
ExecStart=/home/fivem/fxserver/server/run.sh
Restart=on-failure
RestartSec=10
StartLimitBurst=5
StartLimitIntervalSec=60

[Install]
WantedBy=multi-user.target`

### Windows (Task Scheduler)

    - Open Windows Task Scheduler
- Create a new task with trigger "At system startup"
- Action: Run `fxserver.exe`
- Check "Restart if the task fails"

## 2. Use txAdmin Heartbeat

txAdmin can automatically restart your server if it crashes:

    - Open txAdmin → Settings → Server
- Enable "Auto Restart on Crash"
- Set a restart interval (e.g. every 6 hours)

## 3. Identify problems

`# Check FiveM logs
tail -f /home/fivem/fxserver/server/citizen/system.log

# Filter for errors
grep -i error /home/fivem/fxserver/server/citizen/system.log

# txAdmin logs
tail -f /home/fivem/fxserver/server/txData/logs/txadmin.log`
