1

I want to prevent my robots.txt file from syncing to the front end server. Here is my /etc/lsyncd.conf file:

settings = {
        logfile    = "/tmp/lsyncd.log",
        statusFile = "/tmp/lsyncd.stat",
        statusInterval = 1,
}
sync{
        default.rsync,
        source="/var/www/html/blog",
        target="sync:/var/www/html/blog",
        rsyncOpts="-ltus",
        excludeFrom="/var/www/html/blog/robots.txt",
}

The /tmp/lsyncd.log tells

Normal: recursive startup rsync: /var/www/html/blog/ -> sync:/var/www/html/blog/ excluding
HELLO WORLD
Normal: Startup of '/var/www/html/blog/' finished.
Normal: Calling rsync with filter-list of new/modified files/dirs
/robots.txt
/
Normal: Finished a list = 0

This setup doesn't seems to work out.

Maca
  • 1,043
  • 2
  • 19
  • 30

3 Answers3

3

I guess the excludeFrom dir is relative to source dir; thus, excludeFrom="/robots.txt" might work.

EDIT: Oh my God, forget what I wrote above. excludeFrom is an rsync parameter which specifies a text file containing a list of files to be excluded, one file or pattern per line. So, your excludeFrom should contain a path to a file, which then contains this /var/www/html/blog/robots.txt or /robots.txt.

Janne Pikkarainen
  • 31,454
  • 4
  • 56
  • 78
1

Use rsync's --exclude directive in lsyncd's config parameter rsyncOpts, or _extra, depending on the lsyncd version you use.

sjas
  • 305
  • 1
  • 4
  • 12
1

per https://axkibe.github.io/lsyncd/manual/config/layer4/ :

excludeFrom is FILENAME parameter, loads exclusion rules from this file, on rule per line

note that https://community.rackspace.com/general/f/34/t/3503 :

CAUTION! When using excludeFrom and a file, make sure the file has no empty lines in it. If it does, lsyncd treats this as "exclude /" and then everything gets excluded.

p.voinov
  • 11
  • 1