From ccd4201f0d5f95464591073265d20da9b742ba9d Mon Sep 17 00:00:00 2001 From: Hyperling Date: Fri, 9 Jan 2026 11:52:07 -0700 Subject: [PATCH] Add a force variable to Hugo cronjob. --- Config/HugoExample/files/cronjob.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Config/HugoExample/files/cronjob.sh b/Config/HugoExample/files/cronjob.sh index 88accb9..d0481e5 100644 --- a/Config/HugoExample/files/cronjob.sh +++ b/Config/HugoExample/files/cronjob.sh @@ -2,13 +2,15 @@ cd /var/www/hugo/site +FORCE="$1" + echo "*** Running cronjob @ `date` ***" # Pull any updates, and if the project is already up to date, exit successfully. git pull | grep -v "up to date" status="$?" echo "* Pull status is '$status'." -if [[ $status != 0 && -e /var/www/html/index.html ]]; then +if [[ $status != 0 && -e /var/www/html/index.html && -z $FORCE ]]; then echo "* Site is already up to date and copied, exiting." exit 0 fi @@ -16,7 +18,7 @@ fi # If the project was not already up to date, build the new files for NGINX. hugo --gc --minify status="$?" -echo "* Hugo status is '$status'." +echo "* Hugo status is '$status', FORCE is '$FORCE'." if [[ $status == 0 && -e public/index.html ]]; then echo "* Copying files..." rm -rfv /var/www/html/* @@ -24,3 +26,7 @@ if [[ $status == 0 && -e public/index.html ]]; then fi exit 0 +ww/html/ +fi + +exit 0