<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi<div><br></div><div>I am using rsync in combination with lsyncd to do incremental backups.</div><div><br></div><div>The following rsync command is being executed when lsyncd detects that files have changed:</div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">/<span style="text-decoration: underline">usr</span>/bin/<span style="text-decoration: underline">rsync&nbsp;</span>-lptgoDsz&nbsp;--filter=.\ /etc/rsync.filter&nbsp;-r&nbsp;--delete&nbsp;--force&nbsp;--from0&nbsp;--files-from=-&nbsp;/&nbsp;<span style="text-decoration: underline">rsynchead</span>::school</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 13px;">The file /etc/rsync.filter contains the following:</span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 13px;"><br></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><font class="Apple-style-span" face="Helvetica" size="3"><span class="Apple-style-span" style="font-size: 13px;"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">+ /home/*/.<span style="text-decoration: underline">kde</span>/share/<span style="text-decoration: underline">apps</span>/<span style="text-decoration: underline">kmail</span>/mail/**</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">+ /home/*/.<span style="text-decoration: underline">kde</span>/share/<span style="text-decoration: underline">config</span>/<span style="text-decoration: underline">emailidentities</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">+ /home/*/.<span style="text-decoration: underline">kde</span>/share/<span style="text-decoration: underline">config</span>/<span style="text-decoration: underline">kmailrc</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">+ /home/*/.<span style="text-decoration: underline">kde</span>/share/<span style="text-decoration: underline">config</span>/<span style="text-decoration: underline">mailtransports</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">- /home/<span style="text-decoration: underline">git</span>/**</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">- /home/*/.*</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">- /home/*/.*/**</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">+ /etc/<span style="text-decoration: underline">passwd</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">+ /etc/shadow</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">+ /etc/group</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">- /etc/**</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">+ /<span style="text-decoration: underline">var</span>/spool/mail/*</div><div><br></div><div>The list of files from lsyncd is piped to stdin.</div><div><br></div><div>On the rsynchead server I am seeing a lot of entries like:</div><div><br></div><div><div>Mar &nbsp;1 11:23:12 rsynchead1 rsyncd[18773]: connect from <a href="http://fw.school158.gp-online.net">fw.school158.gp-online.net</a> (41.161.29.109)</div><div>Mar &nbsp;1 11:23:13 rsynchead1 rsyncd[18773]: rsync to school158/ from <a href="http://fw.school158.gp-online.net">fw.school158.gp-online.net</a> (41.161.29.109)</div><div>Mar &nbsp;1 11:23:14 rsynchead1 rsyncd[18773]: rsync: connection unexpectedly closed (24 bytes received so far) [Receiver]</div><div>Mar &nbsp;1 11:23:14 rsynchead1 rsyncd[18773]: rsync error: error in rsync protocol data stream (code 12) at io.c(601) [Receiver=3.0.7]</div></div><div><br></div><div>What I suspect is happening is that lsyncd is calling rsync with a list of files all of which get excluded by the filters. Rsync establishes the connection with the server before it realizes that it has nothing to do and then disconnects a bit ungracefully.</div><div><br></div><div>So, is there some way to prevent this from happening, ie if rsync has no files to process that it exits without bothering to contact the remote server?</div><div><br></div></span></font></div><div>
<div>Robert Crida</div><div><a href="mailto:rcrida@clue.co.za">rcrida@clue.co.za</a></div><div><br></div><br class="Apple-interchange-newline">
</div>
<br></div></body></html>