Professional Documents
Culture Documents
http://proyectotictac.wordpress.com
Telfonos: 0426-905.89.44
4.- Ahora genere y / o copie el archivo mirror.sh en el home del root (/root/ ) y
programe su ejecucin diaria automtica dentro del archivo crontab que se
Repblica Bolivariana de Venezuela
PROTECTO TIC - TAC
## Mirror diario
00 18
* * *
root /root/mirror.sh
5.- Espere que llegue la hora de ejecucin del script mirror.sh o ejecutelo
inmediatamente mediante la linea de comando ./mirror.sh . Puede chequear el
proceso de generacin y / o actualizacin del repositorio mediante las lineas de
comando:
tail -f debian-mirror.log
cat debian-mirror.log
http://proyectotictac.wordpress.com
Telfonos: 0426-905.89.44
# Note: You MUST have rsync 2.6.4 or newer, which is available in sarge
# and all newer Debian releases, or at http://rsync.samba.org/
# Don't forget:
# chmod u+x anonftpsync
# Set the variables below to fit your site. You can then use cron to have
# this script run daily to automatically update your copy of the archive.
# RSYNC_HOST is the site you have chosen from the mirrors file.
--exclude source/ \
--exclude *.orig.tar.gz --exclude *.diff.gz --exclude *.dsc \
# --exclude /contrib/ --exclude /non-free/ \
# "
# With a blank EXCLUDE you will mirror the entire archive, except the
# architectures excluded by ARCH_EXCLUDE.
# (optional)
EXCLUDE=
# You may establish the connection via a web proxy by setting the environment
# variable RSYNC_PROXY to a hostname:port pair pointing to your web proxy. Note
# that your web proxys configuration must support proxy connections to port 873.
#
# RSYNC_PROXY="IP:PORT"
# export RSYNC_PROXY=$RSYNC_PROXY
# There should be no need to edit anything below this point, unless there
# are problems.
#-----------------------------------------------------------------------------#
# If you are accessing a rsync server/module which is password-protected,
# uncomment the following lines (and edit the other file).
# . ftpsync.conf
# export RSYNC_PASSWORD
# RSYNC_HOST=$RSYNC_USER@$RSYNC_HOST
#-----------------------------------------------------------------------------#
# The hostname must match the "Site" field written in the list of mirrors.
# If hostname doesn't returns the correct value, fill and uncomment below
# HOSTNAME=mirror.domain.tld
LOCK="${TO}/Archive-Update-in-Progress-${HOSTNAME}"
# Logfile
LOGFILE=$LOGDIR/debian-mirror.log
# optionally, use the rsync module name in the log file name:
# LOGFILE=$LOGDIR/$(echo $RSYNC_DIR | tr / _)-mirror.log
# LOGFILE=$LOGDIR/${RSYNC_DIR/\//_}-mirror.log
# Get in the right directory and set the umask to be group writable
#
cd $HOME
umask 002
# If we are running mirror script for the first time, create the
# destination directory and the trace directory underneath it
if [ ! -d "${TO}/project/trace/" ]; then
mkdir -p ${TO}/project/trace
fi
# Check to see if another sync is in progress
if [ -f "$LOCK" ]; then
# Note: this requires the findutils find; for other finds, adjust as necessary
if [ "`find $LOCK -maxdepth 1 -cmin -$LOCK_TIMEOUT`" = "" ]; then
# Note: this requires the procps ps; for other ps', adjust as necessary
if ps ax | grep '[r]'sync | grep -q $RSYNC_HOST; then
echo "stale lock found, but a rsync is still running, aiee!"
exit 1
else
echo "stale lock found (not accessed in the last $LOCK_TIMEOUT minutes), forcing update!"
rm -f $LOCK
fi
else
echo "current lock file exists, unable to start rsync!"
exit 1
fi
fi
touch $LOCK
# Note: on some non-Debian systems, trap doesn't accept "exit" as signal
# specification. If that's the case on your system, try using "0".
trap "rm -f $LOCK" exit
set +e
#Rsync security
rsync --recursive --links --hard-links --times --verbose --compress --delete \
--exclude "Archive-Update-in-Progress-${HOSTNAME}" \
--exclude "project/trace/${HOSTNAME}" \
$TMP_EXCLUDE $EXCLUDE $SOURCE_EXCLUDE \
$RSYNC_HOST_SEC::$RSYNC_DIR_SEC/ $TO_SEC >> $LOGFILE 2>&1
if [ -n "$MAILTO" ]; then
mail -s "debian archive synced" $MAILTO < $LOGFILE
fi