hugo, try aslo doing BASEURL from the environment rather than only passing to cronjob as a parameter.

This commit is contained in:
me committed 2026-11-13 19:55:38 -07:00
1 parent c79e036fa6
commit 8432fe4e2a
2 files changed
+15 -8

No files matched your search

+9 -2
View File
@@ -3,11 +3,18 @@
cd /var/www/hugo/site cd /var/www/hugo/site
FORCE="$1" FORCE="$1"
BASEURL="$2"
# Pull URL from env if it exists, otherwise var2.
BASEURL="${BASEURL:-$2}"
declare baseurl
if [[ -n "$BASEURL" ]]; then
baseurl="-b $BASEURL"
fi
echo "*** Running cronjob @ `date` ***" echo "*** Running cronjob @ `date` ***"
echo "FORCE=$FORCE" echo "FORCE=$FORCE"
echo "BASEURL=$BASEURL" echo "BASEURL=$BASEURL"
echo "baseurl=$baseurl"
# Pull any updates, and if the project is already up to date, exit successfully. # Pull any updates, and if the project is already up to date, exit successfully.
git pull | grep -v "up to date" git pull | grep -v "up to date"
@@ -20,7 +27,7 @@ fi
# If the project was not already up to date, build the new files for NGINX. # If the project was not already up to date, build the new files for NGINX.
set -x set -x
/usr/local/bin/hugo $BASEURL --gc --minify /usr/local/bin/hugo $baseurl --gc --minify
set +x set +x
status="$?" status="$?"
echo "* Hugo status is '$status', FORCE is '$FORCE'." echo "* Hugo status is '$status', FORCE is '$FORCE'."
+6 -6
View File
@@ -1,23 +1,23 @@
#!/usr/bin/env bash #!/usr/bin/env bash
REPO="$1" export REPO="$1"
echo "REPO='$REPO'" echo "REPO='$REPO'"
BRANCH="$2" export BRANCH="$2"
if [[ -n $BRANCH ]]; then if [[ -n $BRANCH ]]; then
BRANCH="--branch $BRANCH" BRANCH="--branch $BRANCH"
fi fi
echo "BRANCH='$BRANCH'" echo "BRANCH='$BRANCH'"
PROD="$3" export PROD="$3"
typeset -u PROD typeset -u PROD
echo "PROD='$PROD'" echo "PROD='$PROD'"
DEV="$4" export DEV="$4"
typeset -u DEV typeset -u DEV
echo "DEV='$DEV'" echo "DEV='$DEV'"
BASEURL="$5" export BASEURL="$5"
echo "BASEURL='$BASEURL'" echo "BASEURL='$BASEURL'"
baseurl="" baseurl=""
if [[ -n "$BASEURL" ]]; then if [[ -n "$BASEURL" ]]; then
@@ -47,7 +47,7 @@ mv -v $CLONE $SITE
echo "*** Copying Static Files to NGINX ***" echo "*** Copying Static Files to NGINX ***"
rm -rfv /var/www/html/* rm -rfv /var/www/html/*
sudo -u www-data /var/www/hugo/cronjob.sh "" "$baseurl" sudo -u www-data /var/www/hugo/cronjob.sh " " "$BASEURL"
echo "*** Starting Cron ***" echo "*** Starting Cron ***"
service cron start service cron start