Back up and restore#

Back up the world before a build that could spoil it, and restore the backup if it does.

Back up#

$ mciwb backup --backup-name before-castle

This zips the world to ~/mciwb-backups/before-castle.zip. Without --backup-name the backup is named with the date and time, for example 26-11-29.16.05.01.zip.

If the server is running, mciwb first tells it to write the whole world to disk (save-all flush), and pauses its saving until the zip is complete, so the backup is consistent. If the server is stopped, the world folder is just zipped.

A script can back up too, with world.backup("before-castle").

Restore#

$ mciwb restore before-castle

This stops the server, replaces the world with the backup, and starts the server again. Without a name it restores the newest backup. The world that it replaces is deleted: add --keep-old to keep it as ~/mciwb-server/world-old, in place of any world-old from an earlier restore.

Players are disconnected while the server restarts, and can join again afterwards.

Servers with other settings#

Both commands assume the server of a plain mciwb start. If you gave mciwb start other options, give the same ones here:

  • --port and the password (see The RCON password). With the wrong password, mciwb backup warns and zips the world without asking the server to save first.

  • --folder if the server is not in ~/mciwb-server, and --backup-folder to keep backups somewhere other than ~/mciwb-backups.

  • mciwb restore starts the server again, so it also takes --server-name, --world-type and --minecraft-version.

world.backup() always backs up the world in ~/mciwb-server, so only use it with that server. Where there is no world in that folder, mciwb logs backups disabled when it connects and world.backup() does nothing. For a server in another folder, use mciwb backup --folder.

Both commands work on the world’s files, so they need a server on this machine.