Tar and rsync ssh for remote backup

I am trying to do a remote backup with script:

find /path/*.gz -exec rm {} \; && tar -czpvf $BACKUP_DIR/bdsomething-$DATE.tar.gz --exclude='this-file' /source/path && rsync -avhz --progress --delete /path-dir-backup root@10.x.x.x:/path-remote-server

and give me error:

rsync error: syntax or usage error (code 1) at main.c(1637) [Receiver=3.1.0]
./script_bkp.sh: line 9: --delete: command not found

I Have the same kind of script but without –exlude in other script and it works nice and it is in crontab

where wrong syntax? or usage? I do not understand.
Please somebody can help me?

Thank you

Douglas

Hi there - are you trying to perform a Discourse backup this way? You can run a Discourse backup from the command line.

Backup discourse from the command line

3 Likes

My guess is that the error you describe is because you have the delete at the start of a new line and the previous line is not ending with a backslash.

But it’s not clear what your are trying to do.

Hello @pfaffman

I did use --delete to delete what not “new” at the path-remote-server. I did try without --delete but returns that I can not use or syntax or usage error about --progress parameter. I try other forms but not work!

Thanks

Hello @justin
I am sorry I not found where can I post there!

Thank you!