hexparrot / mineos-node

node.js implementation of mineos minecraft management
GNU General Public License v3.0
332 stars 166 forks source link

Dynmap not being excluded from backups #541

Open DR4GONSTEAR opened 5 months ago

DR4GONSTEAR commented 5 months ago

Original "Dynmap not being excluded from backups" I was hoping this would have been changed in the last 3 years but the code hasn't changed at all, and still backs up dynmap maps in /var/games/minecraft/[world]/plugins/dynmap/web/tiles

I have a solution: Change this line: var args = ['--exclude', path.join(self.env.cwd, 'dynmap'), '{0}/'.format(self.env.cwd), self.env.bwd]; To these lines: var excludedFolder = path.join(self.env.cwd, 'servers', '*', 'plugins', 'dynmap', 'web', 'tiles'); var args = ['--exclude', excludedFolder, '{0}/'.format(self.env.cwd), self.env.bwd];

This will stop the backup from including /plugins/dynmap/web/tiles/ which will enable backing up config files, but not the maps.

Under this line: self.archive_with_commit = function(callback) { Change this line: var args = ['czf', path.join(self.env.awd, filename), '.']; To this line: var args = ['czf', path.join(self.env.awd, filename), '--exclude=./plugins/dynmap/web/tiles', '.'];

This will stop archive_with_commit from including /plugins/dynmap/web/tiles/ which will enable backing up config files, but not the maps. It will also leave archive free to continue making full backups that include the map files when run manually.

DR4GONSTEAR commented 5 months ago

I've since realised that archive_with_commit does nothing.

Changing all instances of the line: var args = ['czf', path.join(self.env.awd, filename), '.']; To: var args = ['czf', path.join(self.env.awd, filename), '--exclude=./plugins/dynmap/web/tiles', '.']; would be preferred in that case.

DR4GONSTEAR commented 5 months ago

It didn't even occur to me, but this is true for Paper servers, and its location of plugins/dynmap/web/tiles. If the plugin folder is ever located elsewhere, this would fail to omit the map files in a backup.