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

ncp-backup: exclude pattern not working #1893

Open
CarlosCastaneda opened this issue Apr 2, 2024 · 0 comments
Open

ncp-backup: exclude pattern not working #1893

CarlosCastaneda opened this issue Apr 2, 2024 · 0 comments

Comments

@CarlosCastaneda
Copy link

CarlosCastaneda commented Apr 2, 2024

The script still fails when nextcloud.log has been modified during backup.

Line

--exclude "nextcloud/data/nextcloud.log" \
contains nextcloud/data/ folder instead of $data only. This also applies to the preceeding and following line.
These lines should be replaced by
--exclude "$data/access.log"
--exclude "$data/error.log"
--exclude "$data/nextcloud.log"
or (without double quotes, equal character and no spaces in between)
—exclude=$data/{access,error,nextcloud}.log

Repro:

mkdir -p /tmp/tar_backup/data
touch /tmp/tar_backup/data/{access,error,nextcloud}.log
touch /tmp/tar_backup/data/{text1,text2}.txt
data="data"
tar cvzf /tmp/tar_backup.tgz --exclude "$data/{access,error,nextcloud}.log" -C /tmp/tar_backup data

data/
data/error.log
data/access.log
data/nextcloud.log
data/text1.txt
data/text2.txt

tar cvzf /tmp/tar_backup.tgz --exclude $data/{access,error,nextcloud}.log -C /tmp/tar_backup data

tar: data/error.log: Cannot stat: No such file or directory
tar: data/nextcloud.log: Cannot stat: No such file or directory
data/
data/error.log
data/nextcloud.log
data/text1.txt
data/text2.txt
tar: Exiting with failure status due to previous errors

tar cvzf /tmp/tar_backup.tgz --exclude=$data/{access,error,nextcloud}.log -C /tmp/tar_backup data

data/
data/text1.txt
data/text2.txt

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

1 participant