From 159dbe4b34aa4c9c1f9b14a3722b52e28bbc1be6 Mon Sep 17 00:00:00 2001 From: maride Date: Fri, 28 Jul 2023 09:18:39 +0200 Subject: [PATCH] Write script log --- aux/pull-n-build.sh | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/aux/pull-n-build.sh b/aux/pull-n-build.sh index 2aa2b9b..43c872d 100755 --- a/aux/pull-n-build.sh +++ b/aux/pull-n-build.sh @@ -3,18 +3,23 @@ # stop on error set -e -v -# check if initial git run -if [ ! -d /repo ]; then - # yes - repo needs to be cloned - git clone --recurse-submodules $REPO_URL /repo -else - # no - pull existing repo - cd /repo && git pull --recurse-submodules -fi +{ + # Log date + date -# build and copy over -cd /repo && \ -hugo && \ -rm -rf /usr/share/nginx/html/* && \ -cp -R /repo/public/* /usr/share/nginx/html + # check if initial git run + if [ ! -d /repo ]; then + # yes - repo needs to be cloned + git clone --recurse-submodules $REPO_URL /repo + else + # no - pull existing repo + cd /repo && git pull --recurse-submodules + fi + # build and copy over + cd /repo && \ + hugo && \ + rm -rf /usr/share/nginx/html/* && \ + cp -R /repo/public/* /usr/share/nginx/html + +} 2>&1 > /var/log/blogker-pull-n-build.log