Problematic code:
if [[ $remote == y ]]; then
RSYNCOPTIONS="&& $SSHOPTIONS $BKUSER@$BKSVR mv incomplete_back-$date $2 && rm -f current && ln -s $2 current"
else
RSYNCOPTIONS="mv /backup/incomplete_back-$date /backup/$2 && rm -f /backup/current && ln -s /backup/$2 /backup/current"
fi
rsync -ah \
-e "$SSHOPTIONS" \
--ignore-errors \
--delete \
--delete-excluded \
--exclude-from="$BSPATH"/rsync/exclude \
--link-dest=../current \
"$(dirname ${PWD})" "${RSYNCLOCATION}incomplete_back-${date}" "${RSYNCOPTIONS}"
Error:
Unexpected remote arg: username@server.hostname.com:incomplete_back-2019-08-19T20_00_55
rsync error: syntax or usage error (code 1) at main.c(1214) [sender=3.0.9]
if I remove "${RSYNCOPTIONS}" then it completes without error.
if I echo the results of "${RSYNCOPTIONS}"
ssh -oStrictHostKeyChecking=no -i /root/.ssh/wpo_backups username@server.hostname.com mv incomplete_back-2019-08-19T19_24_51 manual-test && rm -f current && ln -s manual-test current
in this instance remote == y
I can run it manually and it does work. If the entire script is needed, I can provide.