Terraria TShock World file backup system
- Automatically backup your wld file while TShock is running
- Use diff algorithm to drastically reduce disk usage
- Restore any backup with a single server command
/tdiff <date> | restore wld backup at <date>
/tdiff ls | list most recent backups
/tdiff ls <date> | list backups close to given date
tdiff | allow user/group to issue tdiff commands
- This plugin only backup the serving wld file. No backup is made for sqlite, json, etc... tshock related files. Ie if you use SSC you should backup the sqlite db files on your own.
- In order to restore a backup the server shuts off and one has to restart it.
- As of now no backup cleanup logic implemented. The backup folder's size keep growing up (slowly thanks to the diff algorithm).
Every time TShock successfully save the world file this plugin create a diff file of the wld file in a folder next to the original wld file.
Note that a full copy is made if one of the following condition is meet:
- this is the 1st time a backup is made
- the latest full copy was made more than 7 days ago
- the recents diffs files are taking more than 50% of the current world file size
Alternative simplier path to edit & build this plugin is :
- fork
- edit
- commit & push to github
- look at your repo actions (for instance mine is here)
- grab your dll in the Actifacts sections of the latest job
automatically download tshock & setup submodules (with namespace renames) using :
python3 bootstrap.py
Open the solution using your favorite IDE, build the solution and run the unit tests.
Those tests start a tshock server with the plugin installed and perform some tests
In case you don't have them already:
python3 -m pip install --user requests bsdiff4
python3 tests.py
Note that it may take some time (~5min) to run all the tests.
Latest release is in the release section of this repo
assuming there's at least 1 backup:
copy
any wld file found in the backup folder to the worlds folderrename
the copied file as the exact original wld file name.start
tshock with the copied file (the world may be in a really old version that's not important for now)- use
/tdiff <date>
commands to restore the backup you want restart
tshock