# Tar and rsync ssh for remote backup

**URL:** https://meta.discourse.org/t/tar-and-rsync-ssh-for-remote-backup/168784
**Category:** Support
**Created:** [October 30, 2020, 7:27pm UTC](https://meta.discourse.org/t/tar-and-rsync-ssh-for-remote-backup/168784 "2020-10-30T19:27:03Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![doguibnu](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/doguibnu/32/198690_2.png) [@doguibnu](https://meta.discourse.org/u/doguibnu)
#### Post date: [October 30, 2020, 7:27pm UTC](https://meta.discourse.org/t/tar-and-rsync-ssh-for-remote-backup/168784/1 "2020-10-30T19:27:03Z")

</div>

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

---

<div class="post-metadata">

### Author: ![justin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/justin/32/157614_2.png) [@justin](https://meta.discourse.org/u/justin)
#### Post date: [October 30, 2020, 7:48pm UTC](https://meta.discourse.org/t/tar-and-rsync-ssh-for-remote-backup/168784/2 "2020-10-30T19:48:48Z")

</div>

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](https://meta.discourse.org/t/backup-discourse-from-the-command-line/64364)

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [October 31, 2020, 2:09pm UTC](https://meta.discourse.org/t/tar-and-rsync-ssh-for-remote-backup/168784/3 "2020-10-31T14:09:44Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![doguibnu](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/doguibnu/32/198690_2.png) [@doguibnu](https://meta.discourse.org/u/doguibnu)
#### Post date: [October 31, 2020, 2:50pm UTC](https://meta.discourse.org/t/tar-and-rsync-ssh-for-remote-backup/168784/4 "2020-10-31T14:50:12Z")

</div>

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

---

<div class="post-metadata">

### Author: ![doguibnu](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/doguibnu/32/198690_2.png) [@doguibnu](https://meta.discourse.org/u/doguibnu)
#### Post date: [October 31, 2020, 2:53pm UTC](https://meta.discourse.org/t/tar-and-rsync-ssh-for-remote-backup/168784/5 "2020-10-31T14:53:00Z")

</div>

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

Thank you!
