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 · 1 comment
Open

ncp-backup: exclude pattern not working #1893

CarlosCastaneda opened this issue Apr 2, 2024 · 1 comment

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

@CarlosCastaneda
Copy link
Author

The actual script still reflects the old (previous) data directory layout. The directory of the default Installation is „/opt/ncdata/data“. There is no nextcloud directory in the subtree (this can be found in /var/www directory). Hence it does not make sense to exclude nextcloud/{access,error,nextcloud}.log, lines 78 thru 80 should refer $data instead of *nextcloud/data, because those files are located in datadirectory!
That‘s somehow annoying to change those lines after a ncp-update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant