diff options
author | Dennis Eriksen <d@ennis.no> | 2020-04-17 09:59:06 +0200 |
---|---|---|
committer | Dennis Eriksen <d@ennis.no> | 2020-04-17 09:59:06 +0200 |
commit | 371667ee53b37f4d9752dc1001c6188606dc2b5b (patch) | |
tree | ae0706be327c5e83a4d4d64ed03c6e6173125c4b /mkosibuild-cron | |
parent | adding wrapper-script for cron (diff) | |
download | mkosibuild-371667ee53b37f4d9752dc1001c6188606dc2b5b.tar.gz |
changing logging a bit
Diffstat (limited to 'mkosibuild-cron')
-rwxr-xr-x | mkosibuild-cron | 13 |
1 files changed, 8 insertions, 5 deletions
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}" |