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
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
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: