0

I have two shell scripts for synchronising data with the remore, one called out.sh which is supposed to sync local data to the remote and the other called in.sh which is supposed to sync the local data from the remote.

out.sh reads the command

rsync -azEX \
      --itemize-changes \
      --info=BACKUP1,DEL1,NAME1,REMOVE1 \
      --delete \
      --exclude-from=$EXCLUDE_FILE \
      $BCK_SRC $SSH_BCK_DST

in.sh reads the command

rsync -azEX \
      --itemize-changes \
      --info=BACKUP1,DEL1,NAME1,REMOVE1 \
      --delete \
      --exclude-from=$EXCLUDE_FILE \
      $SSH_BCK_SRC $BCK_DST

The exclude file is:

+ /dir1/***
+ /dir2/***
+ /dir3/***
- /***

When I make changes on the local in some file in dir1, and then run out.sh, nothing is copied over, however, in.sh copies over the old file from the remote. It should not I think. But more important is that out.sh does nothing. When I delete the last line in the exclude file, then out.sh copies over the files as expected.

Question 1: How to make the exclude file correctly, so that it only syncs the contents of the directories after the + sign and nothing else.

Question 2: Is the behaviour that in.sh copies older files over the newer files correct?

atapaka
  • 1,172
  • 4
  • 14
  • 30
  • What version of `rsync` is installed on each of the computers (`/***` was added in v2.6.7)? As for keeping newer files, I think you want to add `--update`. – Gordon Davisson Jun 03 '21 at 23:56
  • @GordonDavisson Both are running `rsync version 3.1.3 protocol version 31` both are basically the same machines (Debian stable) when it comes to SW. – atapaka Jun 03 '21 at 23:59

0 Answers0