blob: 2b83672063cbea2abd3be5403b6170c336265dde [file] [log] [blame]
#!/bin/bash
##
## This is the official eclipse.org mirror site script.
##
## Set your options and run once manually, then as a cronjob
##
## Last updated: 2015-06-11 by Denis Roy (webmaster@eclipse.org)
##
##
## User-defined options
# Set the base path for your mirror site here
# No ending /
mirror_path="/path/to/mirror"
# path to your RSYNC binary
RSYNC=/usr/bin/rsync
# Lockfile location - prevents rsync script from re-spawning
LOCKFILE="/tmp/eclipse_lockfile"
# if you rsync from master server, use these options
RSYNC_HOST=download.eclipse.org
RSYNC_PATH=eclipseMirror
# Alternate RSYNC. Comment the master server options above
# RSYNC_HOST=rsync.gtlib.gatech.edu
# RSYNC_PATH=eclipse
# Alternate RSYNC. Comment the master server options above
# RSYNC_HOST=rsync.osuosl.org
# RSYNC_PATH=eclipse
## END: User-defined options
##
#
## Contributed by Gabriel Akos 2005-10-14
host $RSYNC_HOST > /dev/null
hres=$?
if [ $hres -ne 0 ]; then
echo "Eclipse mirror - host $RSYNC_HOST resolution failed" >/dev/stderr
exit 1
fi
if [ -e $LOCKFILE ]; then
echo "Eclipse mirror - Lockfile $LOCKFILE exists" >/dev/stderr
exit 1
fi
touch $LOCKFILE
## END: Contributed by Gabriel Akos 2005-10-14
#
# required "mirror root" timestamp.
# All mirror sites must get this.
$RSYNC -tlvp $RSYNC_HOST::$RSYNC_PATH/TIME $mirror_path
# mirror everything
$RSYNC -rtvp --delete $RSYNC_HOST::$RSYNC_PATH/* $mirror_path
# required "mirror root" timestamp.
# All mirror sites must get this.
$RSYNC -tvp $RSYNC_HOST::$RSYNC_PATH/ztime/* $mirror_path/ztime/
rm $LOCKFILE