From 371667ee53b37f4d9752dc1001c6188606dc2b5b Mon Sep 17 00:00:00 2001 From: Dennis Eriksen Date: Fri, 17 Apr 2020 09:59:06 +0200 Subject: changing logging a bit --- mkosibuild-cron | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'mkosibuild-cron') diff --git a/mkosibuild-cron b/mkosibuild-cron index 8b45a1a..41179e2 100755 --- a/mkosibuild-cron +++ b/mkosibuild-cron @@ -28,16 +28,19 @@ MACHINES=() # Check if logdir exists, and create it if not [[ -d "${LOGDIR}" ]] || mkdir "${LOGDIR}" +chmod 750 "${LOGDIR}" + + +LOG="${LOGDIR}/mkosibuild.log" +touch "${LOG}" && chmod 640 "${LOG}" for machine in ${MACHINES[*]}; do - LOG="${LOGDIR}/${machine}.log" BUILDLOG="${LOGDIR}/${machine}.buildlog.$(date +%Y%m%d%H%M%S)" - touch "${LOG}" && chmod 600 "${LOG}" + touch "${BUILDLOG}" && chmod 640 "${BUILDLOG}" #exec >> "${LOG}" echo "" >> "${LOG}" - echo "Starting build $(date +%Y-%m-%d_%H:%M:%S)" >> "${LOG}" - ${EXEC} "$machine" &>> "${BUILDLOG}" - + echo "$(date '+%Y-%m-%d %H:%M:%S') - Building $machine" >> "${LOG}" + ${EXEC} "$machine" &>> "${BUILDLOG}" && echo "$(date '+%Y-%m-%d %H:%M:%S') - Finished $machine" >> "${LOG}" # Delete old backups find "${BACKUPDIR}" -name "${machine}.*${CRONSUFFIX}" | tail -n +$((BACKUPNUM + 1)) | xargs rm -fv -- >> "${LOG}" -- cgit v1.2.3