From aa3382675c81b9c52ee9003fdcae278c7b6bb8a8 Mon Sep 17 00:00:00 2001 From: TSC competition notification bot Date: Mon, 9 Sep 2024 14:37:59 +0200 Subject: [PATCH] Reduce cron verbosity --- update-cron.sh | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/update-cron.sh b/update-cron.sh index a1e6581..8ba076a 100755 --- a/update-cron.sh +++ b/update-cron.sh @@ -1,9 +1,27 @@ -#!/bin/bash -e +#!/bin/bash -eE exec 100> $HOME/homepage.lock flock 100 +log=$(mktemp) +exec 11>&1 12>&2 > "$log" 2>&1 + +catch_err () { + ( + echo "An error occured during building" + echo "" + cat "$log" + ) >&12 +} + +catch_exit() { + rm -f "$log" +} + +trap catch_err ERR +trap catch_exit EXIT + src=/srv/data/tsc-cloud/homepage/hugo-page dst=/srv/http/tsc/hugo prod=/srv/data/tsc-cloud/homepage/production @@ -87,13 +105,13 @@ echo "Synchronizing files to web server" if [ -n "$publishToStage" ] then echo "Pushing to stage" - time doPublishToStage + ( time doPublishToStage ) fi if [ -n "$publishToProduction" ] then echo "Publishing to production server" - time doPublishToProduction + ( time doPublishToProduction ) fi echo "Deployment done"