[CentOS-mirror] rsync lock files

Alpix

contact at alpix.eu
Fri Mar 8 07:56:33 UTC 2019


Hey Patrick,

thats my sync script.

#!/bin/bash
>
>
>> DESTPATH="/var/www/mirror/centos/"
>
> RSYNC=/usr/bin/rsync
>
> LOCKFILE=/tmp/rsync-centos.lock
>
>
>>
>>
>> synchronize() {
>
>     $RSYNC -rltvHa --delete-after --delay-updates --safe-links
>> eu-msync.centos.org::CentOS "$DESTPATH"
>
> }
>
>
>>
>>
>> if [ ! -e "$LOCKFILE" ]
>
> then
>
>     echo $$ >"$LOCKFILE"
>
>     synchronize
>
> else
>
>     PID=$(cat "$LOCKFILE")
>
>     if kill -0 "$PID" >&/dev/null
>
>     then
>
>         echo "Rsync - Synchronization still running"
>
>         exit 0
>
>     else
>
>         echo $$ >"$LOCKFILE"
>
>         echo "Warning: previous synchronization appears not to have
>> finished correctly"
>
>         synchronize
>
>     fi
>
> fi
>
>
>> rm -f "$LOCKFILE"
>
>
Greetings Alpix


Am Fr., 8. März 2019 um 08:47 Uhr schrieb Alpix <contact at alpix.eu>:

> Hello Patrick,
>
> i have one.
> I will send it  in a few minutes.
>
> Greetings
>
>
> Patrick Shaw <patrick at shaw.co.th> schrieb am Fr., 8. März 2019, 08:42:
>
>> Hi,
>>
>> Does anyone have some examples of lock scripts/files for rsync? Due to
>> slow international performance in this country I'm regularly seeing
>> overlapping rsyncs, I need to get that locked down ASAP.
>>
>> Patrick
>>
>>
>> _______________________________________________
>> CentOS-mirror mailing list
>> CentOS-mirror at centos.org
>> https://lists.centos.org/mailman/listinfo/centos-mirror
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.centos.org/pipermail/centos-mirror/attachments/20190308/ecfdb8b2/attachment-0002.html>


More information about the CentOS-mirror mailing list