X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=config%2Fdebian%2Fcommon;h=0177f1f6fcfd8e1a14b94f32d69a5975607946e1;hb=773f4286615587294d6e6acfb850df53a661bbc5;hp=bc3248c7470dd6cad1b5f8f44398d5bfcffccc6d;hpb=deb1e850a2fb83b0eff6d0761ea4a4aafb406112;p=dak.git diff --git a/config/debian/common b/config/debian/common index bc3248c7..0177f1f6 100644 --- a/config/debian/common +++ b/config/debian/common @@ -4,7 +4,7 @@ # Set $PROGRAM to a string to have it added to the output. function log () { local prefix=${PROGRAM:-} - echo "$(date +"%b %d %H:%M:%S") $(hostname -s) ${prefix}[$$]: $@" + echo "$(date +"%b %d %H:%M:%S") ${HOSTNAME} ${prefix}[$$]: $@" } # log the message using log() but then also send a mail @@ -12,7 +12,7 @@ function log () { function log_error () { log "$@" if [ -z "${MAILTO}" ]; then - echo "$@" | mail -a "X-Debian: DAK" -e -s "[$PROGRAM@$(hostname -s)] ERROR [$$]" -a "From: Debian FTP Masters " ${MAILTO} + echo "$@" | mail -a "X-Debian: DAK" -e -s "[$PROGRAM@${HOSTNAME}] ERROR [$$]" -a "From: Debian FTP Masters " ${MAILTO} fi } @@ -347,7 +347,11 @@ function stage() { # Now we should make sure that we have a usable ${PROGRAM}.log, so # append the $STAGEFILE.log to it. - cat "${STAGEFILE}.log" >> "${LOGFILE}" + if [[ ${TIMESTAMP} == true ]]; then + /usr/bin/ts "%b %d %H:%M:%S ${HOSTNAME} ${PROGRAM}[$$]: ${FUNC} " < "${STAGEFILE}.log" + else + cat "${STAGEFILE}.log" + fi rm -f "${STAGEFILE}.log" log "########## ${PROGRAM} END: ${FUNC} ##########"