mojira.dev
MC-4417

Command save-off does not work as expected

I am working on a server admin script, and am trying to automate backups of my world directories on regular intervals. I know the commands save-off and save-all are what I should be doing to flush the current state to disk before creating my backup. However, I am getting some unexpected behavior I believe is a bug.

My backup-process is basically this:

  1. issue save-all command, wait for "Saved the world" to be output by server

  2. issue save-off command, wait for "Turned off world auto-saving" to be output by server

  3. Create a tar.gz archive via tar czf "/path/to/backup.tar.gz" . (with the server dir as the cwd)

  4. issue save-on command, wait for "Turned on world auto-saving" to be output by server

Currently, I have to add a 5 second delay between steps 2 and 3 because otherwise, my tar command will always fail because files within the directory are modified during the attempt at creating the tar file.

Something in the server output is misleading, my suspicion is either save-all or save-off is reporting completion incorrectly, or perhaps I am not approaching this backup process correctly.

Comments 7

I recently went through the same process as you, but i did something slightly differently.
1. I execute save-off
2. I execute save-all
3. Wait 2 seconds
4. I create the backup
5. I execute save-on

Does this help?

I'll give that a shot, I'll see if I get any better results. I'll report back here soon.

Yeah, that seems to work better and doesn't need the full 5 seconds I was needing before. Still requires a delay unfortunately, which is what I'm hoping can be avoided.

I doubt it can, as it seems commands executed in the server terminal run backgrounded.

Yeah, understandable given it runs multi-threaded. All I'm hoping is that the devs will delay printing "Save Complete" until saving is actually complete, otherwise I can never be entirely sure when it is safe to back-up... without resorting to ridiculous loops/polling. 😛

Resolving then. For "save complete" issue see MC-2527.

How is this resolved? save-off is not doing it's job. Or are we just considering this a duplicate of 2527?

Dominic Barnes

(Unassigned)

Unconfirmed

Minecraft 1.4.5, Snapshot 12w49a

Retrieved