Improve Hugo Configuration #9

Merged
me merged 9 commits from dev into main 2025-08-17 17:06:12 -07:00
Showing only changes of commit 57ade9f67d - Show all commits

View File

@@ -2,10 +2,25 @@
cd /var/www/hugo/site cd /var/www/hugo/site
git pull && hugo --gc --minify echo "*** Running cronjob @ `date` ***"
status="$?"
if [[ $status == 0 && -e public/* ]]; then # Pull any updates, and if the project is already up to date, exit successfully.
rm -rfv /var/www/html/* git pull | grep -v "up to date"
mv -rfv public/* /var/www/html/ status="$?"
echo "* Pull status is '$status'."
if [[ $status != 0 && -e /var/www/html/index.html ]]; then
echo "* Site is already up to date and copied, exiting."
exit 0
fi 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'."
if [[ $status == 0 && -e public/index.html ]]; then
echo "* Copying files..."
rm -rfv /var/www/html/*
mv -v public/* /var/www/html/
fi
exit 0