<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><div class="gmail_signature" dir="ltr"><div dir="ltr"><table style="font-size:small;direction:ltr;max-width:600px"><tbody><tr><td><div>You can use this tool.</div><div><a href="https://github.com/tuna/tunasync">https://github.com/tuna/tunasync</a></div><div><a href="https://github.com/tuna/tunasync-scripts">https://github.com/tuna/tunasync-scripts</a> <br></div></td></tr></tbody></table></div></div></div><br></div></div></div></div></div></div><br><div class="gmail_quote"><div class="gmail_attr" dir="ltr">2019년 3월 9일 (토) 오전 12:00, Dattatec Mirrors <<a href="mailto:mirrors@dattatec.com">mirrors@dattatec.com</a>>님이 작성:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid">El Viernes 08/03/2019 a las 04:42, Patrick Shaw escribió:<br>
> Hi,<br>
><br>
> Does anyone have some examples of lock scripts/files for rsync? Due to<br>
> slow international performance in this country I'm regularly seeing<br>
> overlapping rsyncs, I need to get that locked down ASAP.<br>
><br>
> Patrick<br>
<br>
Hi, I'd advise against using a lock file as f your scripts dies for whatever <br>
reason, the lock file might linger around and prevent future rsyncs from <br>
running.<br>
<br>
Let me qoute a mail from David Richardson to Fedora's mirror mailing list with <br>
an alternative involving flock (last part) and some more general tips that <br>
might be useful for mirror admins:<br>
<br>
"I had the same problem you did with rsync taking forever (and find, and ls, <br>
and httpd).<br>
<br>
Changing the sysctl vm.vfs_cache_pressure made a night-and-day difference <br>
(default is 100, I set it to 10).<br>
<br>
vm.vfs_cache_pressure controls caching of inode data versus file contents.<br>
<br>
The default (and centerpoint) is 100. Values less than 100 favor inode data, <br>
values greater than 100 favors file contents. Do NOT set it to zero.<br>
My understanding that if you set it to zero, bad things will happen and you <br>
will eventually OOM.<br>
<br>
With this change, all my metadata stays in cache. I have two million inodes in <br>
use, and this setting costs me about 4GB of RAM. A no-change Fedora rsync <br>
takes 20 seconds for 425GB of content in 950k files (I exclude development <br>
and SRPMS).<br>
<br>
I use --delete to handle the .~tmp~ directories. If one of my runs aborts, the <br>
next run will clean up after it.<br>
<br>
My script is basically rsync wrapped with flock (rather than trying to cobble <br>
together a lock-file system).<br>
<br>
The 200 in the flock command (and again at the end) is just a filehandle <br>
number; it doesn't really matter what it is, as long as nothing else uses it.<br>
The file name at the end also doesn't much matter. The file needs to be <br>
writeable (or creatable if it doesn't exist), but nothing is written to it.<br>
There's also no need to remove it afterwards.<br>
<br>
<br>
### SCRIPT BEGINS ###<br>
(<br>
flock -n 200 || { echo "Script is already running. Aborting." ; exit 1 ; }<br>
# ... commands executed under lock ...<br>
<br>
/usr/bin/rsync --progress -aHv --update --delete --delete-excluded \<br>
--delete-after --delay-updates rsync://your/source /your/dest/path<br>
<br>
/usr/bin/report_mirror<br>
<br>
) 200>/tmp/lock.update-fedora<br>
### SCRIPT ENDS ###<br>
<br>
Hope you find this useful!"<br>
<br>
<br>
BR,<br>
-- <br>
Ricardo J. Barberis<br>
Senior SysAdmin / IT Architect<br>
DonWeb<br>
La Actitud Es Todo<br>
<a href="http://www.DonWeb.com" target="_blank" rel="noreferrer">www.DonWeb.com</a><br>
_____<br>
_______________________________________________<br>
CentOS-mirror mailing list<br>
<a href="mailto:CentOS-mirror@centos.org" target="_blank">CentOS-mirror@centos.org</a><br>
<a href="https://lists.centos.org/mailman/listinfo/centos-mirror" target="_blank" rel="noreferrer">https://lists.centos.org/mailman/listinfo/centos-mirror</a><br>
</blockquote></div>