Kaiede / Bedrockifier

Command-line tools and Service for Minecraft Servers (Bedrock & Java)
MIT License
39 stars 6 forks source link

[Suggestion] Write backup file in a sub directory #63

Open dvlmemnoch opened 1 year ago

dvlmemnoch commented 1 year ago

Hi I ran into an issue when backing up multiple bedrock servers that have the same world name. For example,

Container A
  server_name: BedrockServer1
    level_name: Survival
Container B
  server_name: BedrockServer2
    level_name: Survival

The backup files generated can conflict if the backup happens quickly. My suggestion would be to put the backup file in a sub directory. So with the example above the backup would look like:

/opt/bedrock/backups/BedrockServer1/Survival.timestamp.mcworld
/opt/bedrock/backups/BedrockServer2/Survival.timestamp.mcworld

or prepend with the server name

/opt/bedrock/backups/BedrockServer1.Survival.timestamp.mcworld
/opt/bedrock/backups/BedrockServer2.Survival.timestamp.mcworld

Of course you would still run into the same problem if the server names were not unique. Not sure if the container name could be used instead since those are required to be unique.

Thank you for this project!

Kaiede commented 6 months ago

I know this is an old enhancement request, but I do like it. I'll add it to the schedule to see if I can find time to implement this.

The trick will be that a change of this nature can really mess with the trim logic. So I'll need to play with getting the upgrade path done and make sure it works properly.

Kaiede commented 1 month ago

Scheduling this for work during 1.3 before I move onto 1.4. This will introduce a new configuration setting that can be set globally, or on a per-container basis. By default it is false, but it can be set to true to add a prefix to the backups.

Container > Global > Default

prefixContainerNameOnBackups: true
containers:
  bedrock:
    - name: Server1
      prefixContainerNameOnBackups: true
  java:
    - name: Server2
      prefixContainerNameOnBackups: true

The result of this will be that the backups would look like this:

<ContainerName>.<WorldName>.<TimeStamp>.ext