Partage
  • Partager sur Facebook
  • Partager sur Twitter

Mirroring Debian

problème avec le script de synchronisation

    6 janvier 2008 à 19:50:39

    Ayant quelques machines tournant sur Debian sur le réseau, je me suis dit qu'il ne serait pas inintéressant d'avoir un miroir sous la main.
    Après une petite recheche Google, je tombe sur ce tuto, clair et facile à mettre en oeuvre.

    Je suis donc chaque étape, j'édite les variables, le fichier crontab, pour que la première synchronisation n'attende pas jusqu'à 2h du mat', je lance une première éxécution

    m'enfin ç'aurait pas été marrant si ça avait marché du premier coup :
    [root@primary debian_mirror]# ./anonftpsync
    ERROR: Help, something weird happened
    mirroring /pool exited with exitcode 23


    je m'empresse donc d'aller voir les logs :
    1. building file list ... rsync: link_stat "/root/ftp.free.fr/::/mnt/mirror/pub/debian/pool/." failed: No such file or directory (2)
    2. done
    3. sent 21 bytes  received 20 bytes  82.00 bytes/sec
    4. total size is 0  speedup is 0.00
    5. rsync error: some files could not be transferred (code 23) at main.c(977) [sender=2.6.9]
    6. ERROR: Help, something weird happened
    7. mirroring /pool exited with exitcode 23


    je soupçonne l'erreur d'être provoqué par ce rsync:///root/ftp.free.fr/ , qui bien entendu n'existe pas, d'où le "No such file or directory"

    malheureusement, j'ai beau fouiller le script, je ne trouve pas à quel moment est rajouté le /root/


    je vous donne donc le script avec mes variables :
    1. #! /bin/sh
    2. set -e
    3. # This script originates from http://www.debian.org/mirror/anonftpsync
    4. # CVS: cvs.debian.org:/cvs/webwml - webwml/english/mirror/anonftpsync
    5. # Version: $Id: anonftpsync,v 1.33 2007/09/12 15:19:03 joy Exp $
    6. # Note: You MUST have rsync 2.6.4 or newer, which is available in sarge
    7. # and all newer Debian releases, or at http://rsync.samba.org/
    8. # Dont forget:
    9. # chmod u+x anonftpsync
    10. # Set the variables below to fit your site. You can then use cron to have
    11. # this script run daily to automatically update your copy of the archive.
    12. # TO is the destination for the base of the Debian mirror directory
    13. # (the dir that holds dists/ and ls-lR).
    14. # (mandatory)
    15. TO=/mnt/mirror/pub/debian
    16. # RSYNC_HOST is the site you have chosen from the mirrors file.
    17. # (http://www.debian.org/mirror/list-full)
    18. # (mandatory)
    19. RSYNC_HOST=ftp.free.fr/
    20. # RSYNC_DIR is the directory given in the "Packages over rsync:" line of
    21. # the mirrors file for the site you have chosen to mirror.
    22. # (mandatory)
    23. RSYNC_DIR=/mnt/mirror/pub/debian
    24. # LOGDIR is the directory where the logs will be written to
    25. # (mandatory)
    26. LOGDIR=/mnt/mirror/private/debian_mirror/logs
    27. # ARCH_EXCLUDE can be used to exclude a complete architecture from
    28. # mirrorring. Please use as space seperated list.
    29. # Possible values are:
    30. # alpha, amd64, arm, hppa, hurd-i386, i386, ia64, m68k, mipsel, mips, powerpc, s390, sh and sparc
    31. #
    32. # There is one special value: source
    33. # This is not an architecture but will exclude all source code in /pool
    34. #
    35. # eg.
    36. # ARCH_EXCLUDE="alpha arm hppa hurd-i386 ia64 m68k mipsel mips s390 sparc"
    37. #
    38. # With a blank ARCH_EXCLUDE you will mirror all available architectures
    39. # (optional)
    40. ARCH_EXCLUDE="alpha alph amd64 arm hppa hurd-i386 ia64 m68k mipsel mips powerpc s390 sh sparc"
    41. # EXCLUDE is a list of parameters listing patterns that rsync will exclude, in
    42. # addition to the architectures excluded by ARCH_EXCLUDE.
    43. #
    44. # Use ARCH_EXCLUDE to exclude specific architectures or all sources
    45. #
    46. # --exclude stable, testing, unstable options DONT remove the packages of
    47. # the given distribution. If you want do so, use debmirror instead.
    48. #
    49. # The following example would exclude mostly everything:
    50. #EXCLUDE="\
    51. #  --exclude stable/ --exclude testing/ --exclude unstable/ \
    52. #  --exclude source/ \
    53. #  --exclude *.orig.tar.gz --exclude *.diff.gz --exclude *.dsc \
    54. #  --exclude /contrib/ --exclude /non-free/ \
    55. # "
    56. # With a blank EXCLUDE you will mirror the entire archive, except the
    57. # architectures excluded by ARCH_EXCLUDE.
    58. # (optional)
    59. EXCLUDE=
    60. # MAILTO is the address to send logfiles to;
    61. # if it is not defined, no mail will be sent
    62. # (optional)
    63. MAILTO=...@gmail.com
    64. # LOCK_TIMEOUT is a timeout in minutes.  Defaults to 360 (6 hours).
    65. # This program creates a lock to ensure that only one copy
    66. # of it is mirroring any one archive at any one time.
    67. # Locks held for longer than the timeout are broken, unless
    68. # a running rsync process appears to be connected to $RSYNC_HOST.
    69. LOCK_TIMEOUT=360
    70. # There should be no need to edit anything below this point, unless there
    71. # are problems.
    72. #-----------------------------------------------------------------------------#
    73. # If you are accessing a rsync server/module which is password-protected,
    74. # uncomment the following lines (and edit the other file).
    75. # . ftpsync.conf
    76. # export RSYNC_PASSWORD
    77. # RSYNC_HOST=$RSYNC_USER@$RSYNC_HOST
    78. #-----------------------------------------------------------------------------#
    79. # Check for some environment variables
    80. if [ -z $TO ] || [ -z $RSYNC_HOST ] || [ -z $RSYNC_DIR ] || [ -z $LOGDIR ]; then
    81.         echo "One of the following variables seems to be empty:"
    82.         echo "TO, RSYNC_HOST, RSYNC_DIR or LOGDIR"
    83.         exit 2
    84. fi
    85. if ! [ -d ${TO}/project/trace/ ]; then
    86.         # we are running mirror script for the first time
    87.         umask 002
    88.         mkdir -p ${TO}/project/trace
    89. fi
    90. # Note: on some non-Debian systems, hostname doesnt accept -f option.
    91. # If thats the case on your system, make sure hostname prints the full
    92. # hostname, and remove the -f option. If theres no hostname command,
    93. # explicitly replace `hostname -f` with the hostname.
    94. HOSTNAME=`hostname -f`
    95. # The hostname must match the "Site" field written in the list of mirrors.
    96. # If hostname doesnt returns the correct value, fill and uncomment below
    97. # HOSTNAME=mirror.domain.tld
    98. LOCK="${TO}/Archive-Update-in-Progress-${HOSTNAME}"
    99. # The temp directory used by rsync --delay-updates is not
    100. # world-readable remotely. It must be excluded to avoid errors.
    101. TMP_EXCLUDE="--exclude .~tmp~/"
    102. # Exclude architectures defined in $ARCH_EXCLUDE
    103. for ARCH in $ARCH_EXCLUDE; do
    104.         EXCLUDE=$EXCLUDE"\
    105.                 --exclude binary-$ARCH/ \
    106.                 --exclude disks-$ARCH/ \
    107.                 --exclude installer-$ARCH/ \
    108.                 --exclude Contents-$ARCH.gz \
    109.                 --exclude Contents-$ARCH.diff/ \
    110.                 --exclude arch-$ARCH.files \
    111.                 --exclude arch-$ARCH.list.gz \
    112.                 --exclude *_$ARCH.deb \
    113.                 --exclude *_$ARCH.udeb "
    114.         if [ "$ARCH" == "source" ]; then
    115.                 SOURCE_EXCLUDE="\
    116.                 --exclude source/ \
    117.                 --exclude *.tar.gz \
    118.                 --exclude *.diff.gz \
    119.                 --exclude *.dsc "
    120.         fi
    121. done
    122. # Logfile
    123. LOGFILE=$LOGDIR/debian-mirror.log
    124. # Get in the right directory and set the umask to be group writable
    125. #
    126. cd $HOME
    127. umask 002
    128. # Check to see if another sync is in progress
    129. if [ -f "$LOCK" ]; then
    130. # Note: this requires the findutils find; for other finds, adjust as necessary
    131.   if [ "`find $LOCK -maxdepth 1 -amin -$LOCK_TIMEOUT`" = "" ]; then
    132. # Note: this requires the procps ps; for other ps, adjust as necessary
    133.     if ps ax | grep '[r]'sync | grep -q $RSYNC_HOST; then
    134.       echo "stale lock found, but a rsync is still running, aiee!"
    135.       exit 1
    136.     else
    137.       echo "stale lock found (not accessed in the last $LOCK_TIMEOUT minutes), forcing update!"
    138.       rm -f $LOCK
    139.     fi
    140.   else
    141.     echo "current lock file exists, unable to start rsync!"
    142.     exit 1
    143.   fi
    144. fi
    145. touch $LOCK
    146. # Note: on some non-Debian systems, trap doesnt accept "exit" as signal
    147. # specification. If thats the case on your system, try using "0".
    148. trap "rm -f $LOCK" exit
    149. set +e
    150. # First sync /pool
    151. rsync --recursive --links --hard-links --times --verbose \
    152.      $TMP_EXCLUDE $EXCLUDE $SOURCE_EXCLUDE \
    153.      $RSYNC_HOST::$RSYNC_DIR/pool/ $TO/pool/ >> $LOGFILE 2>&1
    154. result=$?


    et la partie qui - je pense - provoque l'erreur :
    1. if [ 0 = $result ]; then
    2.         # Now sync the remaining stuff
    3.         rsync --recursive --links --hard-links --times --verbose --delay-updates --delete-after \
    4.              --exclude "Archive-Update-in-Progress-${HOSTNAME}" \
    5.              --exclude "project/trace/${HOSTNAME}" \
    6.              $TMP_EXCLUDE $EXCLUDE $SOURCE_EXCLUDE \
    7.              $RSYNC_HOST::$RSYNC_DIR $TO >> $LOGFILE 2>&1
    8.         LANG=C date -u > "${TO}/project/trace/${HOSTNAME}"
    9. else
    10.         echo "ERROR: Help, something weird happened" | tee -a $LOGFILE
    11.         echo "mirroring /pool exited with exitcode" $result | tee -a $LOGFILE
    12. fi
    13. if ! [ -z $MAILTO ]; then
    14.         mail -s "debian archive synced" $MAILTO < $LOGFILE
    15. fi
    16. rm $LOCK
    • Partager sur Facebook
    • Partager sur Twitter
    What's it called? Monorail... Once again! MONORAIL!

    Mirroring Debian

    × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
    × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
    • Editeur
    • Markdown