Pricetx/backup

tar error message on Linux

Closed this issue · 4 comments

Running "backup.sh" gives this error on Linux:

tar: You must specify one of the '-Acdtrux', '--delete' or '--test-label' options
Try 'tar --help' or 'tar --usage' for more information.

I think this happens because I have nothing in the exclude list, so the script attempts to run tar incorrectly with these options:

tar --exclude -zcf /backups/gateway/nigelhorne.force9.co.uk-2015-07-24-1317.tgz /backups/bin/backup.cfg /etc/

The fix is something like (untested) replacing:

for i in "${EXCLUDE[@]}"; do
TARCMD="--exclude $i ${TARCMD}"
done

with

if [[ "x$EXCLUDE" != "x"]]; then
for i in "${EXCLUDE[@]}"; do
TARCMD="--exclude $i ${TARCMD}"
done
fi

Hi, and thanks for the issue report. Having done some testing It appears to work in Debian Wheezy but not Debian Jessie. I'll try to work out what's causing the change in behaviour later this evening.

I'm working on it now - to clarify, does the replacement code not work on Jessie or the original code?

I am using Debian stretch/sid if that helps.