Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
murkyl opened this issue Apr 16, 2021 · 1 comment
Closed

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

murkyl opened this issue Apr 16, 2021 · 1 comment
Assignees

Comments

@murkyl
Copy link

murkyl commented Apr 16, 2021

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)

@TheRemote
Copy link
Owner

Thank you, I have committed your fix!

TheRemote added a commit that referenced this issue Apr 22, 2021
@TheRemote TheRemote self-assigned this May 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants