diff options
author | Eugene Paskevich <eugene@raptor.kiev.ua> | 2014-05-06 22:09:03 +0300 |
---|---|---|
committer | Joerg Jaspert <joerg@debian.org> | 2014-05-08 10:42:52 +0200 |
commit | 26df6757ada617f423f653e114cfacfe40e607cd (patch) | |
tree | fbef804fad7b48afcbe66d8a598b7a27800b8734 /bin/ftpsync | |
parent | 9a34477b2a53e0a634db111095139b568ff3898a (diff) |
Revised trace file generation a bit.
- Added an option to write the date only.
- Added an option to change the hostname written into the trace file.
- Open the new temporary trace file for writing only once.
Diffstat (limited to 'bin/ftpsync')
-rwxr-xr-x | bin/ftpsync | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/bin/ftpsync b/bin/ftpsync index c30563a..0aa7a17 100755 --- a/bin/ftpsync +++ b/bin/ftpsync @@ -281,7 +281,8 @@ TRACE=${TRACE:-"project/trace/${MIRRORNAME}"} # what it will be. # Possible values are # "full" - all information -# "terse" - basic, timestamp only (date -u) +# "terse" - partial, ftpsync version and local hostname +# "date" - basic, timestamp only (date -u) # "touch" - just touch the file in existance # "none" - no tracefile at all # @@ -608,26 +609,30 @@ if [ "xtruex" = "x${SYNCSTAGE2}x" ] || [ "xtruex" = "x${SYNCALL}x" ]; then log "Just touching the trace file" touch "${TO}/${TRACE}" ;; - terse|full) + date|terse|full) log "Creating a ${EXTENDEDTRACE} trace file" if [ -d "$(dirname "${TO}/${TRACE}")" ]; then - LC_ALL=POSIX LANG=POSIX date -u > "${TO}/${TRACE}.new" - echo "Used ftpsync version: ${VERSION}" >> "${TO}/${TRACE}.new" - echo "Running on host: $(hostname -f)" >> "${TO}/${TRACE}.new" - if [ "xfullx" = "x${EXTENDEDTRACE}x" ]; then - GLOBALARCHLIST="source amd64 armel armhf hurd-i386 i386 ia64 kfreebsd-amd64 kfreebsd-i386 mips mipsel powerpc s390 s390x sparc" - - AEXCLUDE="^${ARCH_EXCLUDE// /\$|^}$" - ARCHLIST="" - for ARCH in ${GLOBALARCHLIST}; do - if ! [[ ${ARCH} =~ ${AEXCLUDE} ]]; then - ARCHLIST="${ARCHLIST} ${ARCH}" - fi - done - out="GUESSED:{${ARCHLIST}}" - echo "Architectures: ${out}" >> "${TO}/${TRACE}.new" - echo "Upstream-mirror: ${RSYNC_HOST}" >> "${TO}/${TRACE}.new" - fi # full trace + { + LC_ALL=POSIX LANG=POSIX date -u + if [ "xdatex" != "x${EXTENDEDTRACE}x" ]; then + echo "Used ftpsync version: ${VERSION}" + echo "Running on host: ${TRACEHOST:-$(hostname -f)}" + if [ "xfullx" = "x${EXTENDEDTRACE}x" ]; then + GLOBALARCHLIST="source amd64 armel armhf hurd-i386 i386 ia64 kfreebsd-amd64 kfreebsd-i386 mips mipsel powerpc s390 s390x sparc" + + AEXCLUDE="^${ARCH_EXCLUDE// /\$|^}$" + ARCHLIST="" + for ARCH in ${GLOBALARCHLIST}; do + if ! [[ ${ARCH} =~ ${AEXCLUDE} ]]; then + ARCHLIST="${ARCHLIST} ${ARCH}" + fi + done + out="GUESSED:{${ARCHLIST}}" + echo "Architectures: ${out}" + echo "Upstream-mirror: ${RSYNC_HOST}" + fi # full trace + fi # other traces + } > "${TO}/${TRACE}.new" mv "${TO}/${TRACE}.new" "${TO}/${TRACE}" fi ;; |