Newer
Older
#!/bin/bash
#/usr/local/sbin/esamesync-esame.sh
# Host for the sync operation
ESAMESYNCHOST=master2.edu-al.unipmn.it
# Configuration override can go to:
. /etc/sysconfig/esamesync-esame
/usr/local/bin/bta-netwait ${ESAMESYNCHOST}
/bin/cat <<MSG
Starting /opt/esame syncronization (if it seems to be stuck, please wait for
a few minutes for your updates to take place; they can require a long time)
DON'T TURN OFF THIS MACHINE NOW, JUST WAIT UNTIL FINISHED
MSG
DST=/opt/esame/
SRC=rsync://${ESAMESYNCHOST}/opt/esame/
cd ${DST}
# To fix spurious errors, we pause and repeat the sync if necessary.
# Note: excluding /opt/google as that is installed locally with RPMs.
# Note: excluding /opt/esame as it is already syncronized on every boot.
#
while ! rsync -avq --sparse --progress --delete ${SRC} . ; do
sleep $(expr $RANDOM % 7200);
done