nextcloudpi icon indicating copy to clipboard operation
nextcloudpi copied to clipboard

ncp-backup: exclude pattern not working

Open CarlosCastaneda opened this issue 1 year ago • 2 comments

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

Line https://github.com/nextcloud/nextcloudpi/blob/f0fc7e074e8147a6f6b6b036159195ad6c0a360c/bin/ncp-backup#L80 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 avatar Apr 02 '24 20:04 CarlosCastaneda

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.

CarlosCastaneda avatar Aug 25 '24 11:08 CarlosCastaneda