Hi @StefanoG .
Here I would advise you to troubleshoot the issue without the current script. Try to take a backup manually wiht xtrabackup passing --defaults-file=/etc/mysql/backup.cnf and check if it works. If it doesn’t try to manually pass the username and password via parameters (–user --password).