#!/bin/sh HOST=msync-dvd.centos.org REPO=CentOS-incdvd IP=`/usr/bin/dig $HOST +short` if [ -e /home/rsyncuser/bin/Lock.SyncRepos.sh ] ; then echo CentOS Rsync Lock file found!! else touch /home/rsyncuser/bin/Lock.SyncRepos.sh if [ -e /somedirectory/centos/ ] ; then /bin/echo -n "$HOST: $IP - " date ## Checking the timestamp... /usr/bin/rsync -azqH $IP::$REPO/timestamp.txt /tmp/ currtime=`date +%s` myfilemtime=`stat -c %Y /somedirectory/centos/timestamp.txt` filemtime=`stat -c %Y /tmp/timestamp.txt` diff=$(( currtime - filemtime )) printf "\nRepo updated "%dh:%dm:%ds" ago.\n\n" $(($diff/3600)) $(($diff%3600/60)) $(($diff%60)) if [ $myfilemtime -ge $filemtime ] ## If the mirror is older or equal to mine then echo Their timestamp is older or equal to ours, not syncing... echo echo -n 'Theirs: ' cat /tmp/timestamp.txt echo -n 'Ours: ' cat /somedirectory/centos/timestamp.txt else /usr/bin/rsync -avzH --delay-updates --delete --delete-after --delete-excluded --exclude='.~tmp~' $IP::$REPO /somedirectory/centos/ echo echo echo Sycning any new .torrent files to Garrison and Ginger rm /storage/Torrents/TorrentWatch/* /usr/bin/find /somedirectory/ -name '*.torrent' |while read i; do cp -a "$i" /storage/Torrents/TorrentWatch/; done echo Garrison: /usr/bin/rsync -qtprLP --delete /storage/Torrents/TorrentWatch/ garrison.gmavt.net::my_hidden_upload_torrent echo echo Ginger: /usr/bin/rsync -qtprLP --delete /storage/Torrents/TorrentWatch/ ginger.gmavt.net::my_hidden_upload_torrent fi else echo CentOS Rsync mount not found!! fi rm /home/rsyncuser/bin/Lock.SyncRepos.sh fi