[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Git][ftp-team/dak][deploy] 4 commits: Rename ts function as it shadows the ts util



Title: GitLab

Joerg Jaspert pushed to branch deploy at Debian FTP Team / dak

Commits:

2 changed files:

Changes:

  • config/debian/common
    ... ... @@ -78,7 +78,7 @@ TEMPFILES=${TEMPFILES:-""}
    78 78
     TMPFILES=${TMPFILES:-""}
    
    79 79
     
    
    80 80
     # Timestamp. Used for dinstall stat graphs
    
    81
    -function ts() {
    
    81
    +function log_timestamp() {
    
    82 82
         echo "Archive maintenance timestamp ($1): $(date +%H:%M:%S)"
    
    83 83
     }
    
    84 84
     
    
    ... ... @@ -457,12 +457,6 @@ function stage() {
    457 457
         # to be elsewhere, it has to cd first!
    
    458 458
         cd ${configdir}
    
    459 459
     
    
    460
    -    # Now redirect the output into $STAGEFILE.log. In case it errors
    
    461
    -    # out somewhere our errorhandler trap can then mail the contents
    
    462
    -    # of $STAGEFILE.log only, instead of a whole ${PROGRAM} logfile.
    
    463
    -    # Short error mails ftw!
    
    464
    -    exec >> "${STAGEFILE}.log" 2>&1
    
    465
    -
    
    466 460
         if [[ -f ${LOCK_STOP} ]]; then
    
    467 461
             log "${LOCK_STOP} exists, exiting immediately"
    
    468 462
             exit 42
    
    ... ... @@ -472,7 +466,16 @@ function stage() {
    472 466
         if [[ ${error} == false ]]; then
    
    473 467
             set +e
    
    474 468
         fi
    
    475
    -    ${FUNC} ${ARGS}
    
    469
    +
    
    470
    +    # Now redirect the output into $STAGEFILE.log. In case it errors
    
    471
    +    # out somewhere our errorhandler trap can then mail the contents
    
    472
    +    # of $STAGEFILE.log only, instead of a whole ${PROGRAM} logfile.
    
    473
    +    # Short error mails ftw!
    
    474
    +    if [[ ${TIMESTAMP} == true ]]; then
    
    475
    +      ${FUNC} ${ARGS} 2>&1 | tee -a "${STAGEFILE}.log" | ts "%b %d %H:%M:%S ${HOSTNAME} ${PROGRAM}[$$]: ${FUNC} "
    
    476
    +    else
    
    477
    +      ${FUNC} ${ARGS} 2>&1 | tee -a "${STAGEFILE}.log"
    
    478
    +    fi
    
    476 479
     
    
    477 480
         # No matter what happened in the function, we make sure we have
    
    478 481
         # set -e default state back
    
    ... ... @@ -488,19 +491,9 @@ function stage() {
    488 491
         touch "${STAGEFILE}"
    
    489 492
     
    
    490 493
         if [[ -n ${TIME} ]]; then
    
    491
    -        ts "${TIME}"
    
    494
    +        log_timestamp "${TIME}"
    
    492 495
         fi
    
    493 496
     
    
    494
    -    # And the output goes back to the normal logfile
    
    495
    -    exec >> "${LOGFILE}" 2>&1
    
    496
    -
    
    497
    -    # Now we should make sure that we have a usable ${PROGRAM}.log, so
    
    498
    -    # append the $STAGEFILE.log to it.
    
    499
    -    if [[ ${TIMESTAMP} == true ]]; then
    
    500
    -        /usr/bin/ts "%b %d %H:%M:%S ${HOSTNAME} ${PROGRAM}[$$]: ${FUNC} " < "${STAGEFILE}.log"
    
    501
    -    else
    
    502
    -        cat "${STAGEFILE}.log"
    
    503
    -    fi
    
    504 497
         rm -f "${STAGEFILE}.log"
    
    505 498
     
    
    506 499
         log "########## ${PROGRAM} END: ${FUNC} ##########"
    

  • config/debian/dinstall.functions
    ... ... @@ -14,7 +14,7 @@ function remove_all_locks() {
    14 14
     function remove_locks {
    
    15 15
         remove_all_locks
    
    16 16
         trap - EXIT TERM HUP INT QUIT
    
    17
    -    ts "locked part finished"
    
    17
    +    log_timestamp "locked part finished"
    
    18 18
     }
    
    19 19
     
    
    20 20
     # Lock accepted
    
    ... ... @@ -662,7 +662,7 @@ function signotherfiles() {
    662 662
     
    
    663 663
     function startup() {
    
    664 664
         touch "${DINSTALLSTART}"
    
    665
    -    ts "startup"
    
    665
    +    log_timestamp "startup"
    
    666 666
         lockfile -l 3600 "${LOCK_DAILY}"
    
    667 667
         trap onerror ERR
    
    668 668
         touch "${LOCK_BRITNEY}"
    


  • Reply to: