Grand opening25% off everything with FAM-261023-261025-UL4B9this weekendTick it in your cart Halloween Edition36 maps, limited runlimited runShop the drop
Chapter 14 of 17The Server Handbook for FiveM

Restarts, backups and updates

In short

Stable servers are boring on purpose: fixed restart times, automatic backups, a test server for updates and a written rollback plan.

WhenRoutine
Every restartSave player data in txAdmin’s restart and shutdown events
DailyDatabase dump, compressed and copied off the machine
WeeklyDisk space, txAdmin diagnostics, resmon on a busy evening
Every updateTest on a dev server, back up, deploy in a quiet hour, keep the old version
MonthlyRestore a backup to a spare database to prove it works
Saving before txAdmin restarts (server)
AddEventHandler('txAdmin:events:scheduledRestart', function(data)
    if data.secondsRemaining == 60 then
        -- save everything that is not saved yet
    end
end)

AddEventHandler('txAdmin:events:serverShuttingDown', function()
    -- final save
end)

txAdmin announces a scheduled restart 30, 15, 10, 5, 4, 3, 2 and 1 minutes before it happens, and restarts crashed servers automatically.

/opt/fivem/backup.sh — run daily from cron (0 5 * * *)
#!/bin/sh
STAMP=$(date +%F-%H%M)
mariadb-dump --single-transaction fivem | gzip > /backups/fivem-$STAMP.sql.gz
tar --exclude='server-data/cache' -czf /backups/server-data-$STAMP.tar.gz -C /home/fivem server-data
find /backups -type f -mtime +14 -delete
  • Read the artifact changelog, then update the test server first.
  • Keep the previous artifact folder — rolling back is switching folders.
  • Update one resource at a time and watch the console after each.
  • Copy backups off the machine; a backup on the same disk dies with it.

The Server Handbook for FiveM

This chapter is one of 17. The handbook also carries the console command and convar cheat sheets, a glossary and the official references every chapter is checked against.

Open the handbook