Rsync script failing after update

The environment is Rocky Linux 8.6 and RHEL 8.6

I have the following bash code, which I run on RHEL, and the remote server, which has Rocky Linux.

USER_AT_SERVER="user@myserver.com"
FOLDER_TO_BACKUP="{/etc,/var}"
BACKUP_FOLDER="/Backup"
EXCLUDE_FILE=/exclude.txt
rsync --inplace -l -a -t -r -v  -p -o -g --exclude-from $EXCLUDE_FILE --rsync-path="sudo rsync" $USER_AT_SERVER:$FOLDER_TO_BACKUP $BACKUP_FOLDER

This was working without any issues till about one and a half weeks ago.
Suddenly the script started failing every day.

with the error

rsync: change_dir "/home/user//{/etc," failed: No such file or directory (2)

All I did was do DNF updates.
Why is this code failing?

Hello @lee
The error you are describing usually occurs when the remote system does not have the directories. Check your remote and make sure those directories are there. The act of doing an update should not have broken this. Is it possible that something else happened as well?

I don’t know the reason either, but you have a for each task that you could do:

USER_AT_SERVER="user@myserver.com"
BACKUP_FOLDER="/Backup"
EXCLUDE_FILE=/exclude.txt
ROPT="--inplace -l -a -t -r -v -p -o -g"
for SRC in /etc /var
do
  rsync $ROPT  --exclude-from $EXCLUDE_FILE --rsync-path="sudo rsync" ${USER_AT_SERVER}:${SRC}/ ${BACKUP_FOLDER}${SRC}/
done

The solution for my case was

eval sudo rsync --inplace -l -a -t -r -v  -p -o -g --exclude-from $EXCLUDE_FILE --rsync-path=\"sudo rsync\" $USER_AT_SERVER:$FOLDER_TO_BACKUP $BACKUP_FOLDER

Missed the ‘sudo’ in the question.

Thanks to some troubleshooting by my co-workers (former and current).
@jlehtone I would have chosen your suggestion if ours did not work.
Thanks, everyone, for the suggestions.