Skip to content

Removing old backups is done in the wrong directory context #76

Closed
@murkyl

Description

@murkyl

The default script does the following for removing old backups:

# Rotate backups -- keep most recent 10
Rotate=$(ls -1tr dirname/minecraftbe/servername/backups | head -n -10 | xargs -d '\n' rm -f --)

The problem is that the 'rm' command that xargs is operating on is just the list of files but rm is performing them in the wrong working directory.

A simple fix for this would be to change to the correct directory first. So the following works:

# Rotate backups -- keep most recent 10
Rotate=$(pushd dirname/minecraftbe/servername/backups; ls -1tr | head -n -10 | xargs -d '\n' rm -f --; popd)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions