]> git.pond.sub.org Git - empserver/blob - doc/backups
client: Unbreak standalone build
[empserver] / doc / backups
1 Why backups
2 -----------
3
4 Running a game without regular backups is irresponsible.  A bug, a
5 system crash or a deity error can destroy the game, leaving you no way
6 to recover except restoring from backup.  If you foolishly neglected
7 to make regular, working backups, then players, who likely invested
8 substantial time in your game, will have every reason to be very angry
9 with you.
10
11
12 Manual backups
13 --------------
14
15 The recommended way to make a backup is to shut down the server, copy
16 the complete data directory, then restart the server.
17
18 Having to shut down the server for backups is inconvenient, and we're
19 working on better solutions.
20
21 Copying the data directory while the server runs is *unsafe*: the copy
22 may be inconsistent, because files may change during copying.
23 However, it works more often than not, and is much better than making
24 no backups.
25
26
27 Automatic backups
28 -----------------
29
30 The server lets you run an arbitrary command right before the update,
31 with players locked out.  You can use this feature to make a backup
32 on each update automatically.
33
34 The command runs in the data directory.  stdin, stdout, stderr are
35 redirected to /dev/null.  Beware: if it exits unsuccessfully, the
36 update is cancelled!  An example backup script can be found in
37 scripts/backup.
38
39 You define the command in econfig, like this:
40
41   pre_update_hook "/wherever/backup"
42
43
44 Restoring from backup
45 ---------------------
46
47 The server must not be running when you restore a backup.
48
49 Always restore the complete data directory.  Restoring individual
50 files from backups can lead to inconsistencies.  Some of the known
51 problems with partial restores are:
52
53  * In games with MOB_ACCESS enabled, mobility will be extremely out of
54    sync.
55
56  * Land units, ships and planes may think they are loaded onto ships
57    or land units that do not exist, or have changed owner (been sunk
58    or destroyed and then rebuilt) since the last backup.
59
60 Testing backups
61 ---------------
62
63 Backups are worthless unless you verify restoring works.  Using the
64 real game to verify causes down time.  It's smarter to have a second
65 game, inaccessible to the public, running the same server program.  If
66 it runs on the same machine, it has to use a different port, and that
67 means a different econfig file.  Make sure not to clobber it when you
68 restore a backup from the real game.