Compare commits
4 Commits
0371059706
...
5f9c95e4c0
| Author | SHA1 | Date | |
|---|---|---|---|
| 5f9c95e4c0 | |||
| ef575d0b08 | |||
| ccd4201f0d | |||
| fd3fc6eb41 |
@@ -2,13 +2,15 @@
|
|||||||
|
|
||||||
cd /var/www/hugo/site
|
cd /var/www/hugo/site
|
||||||
|
|
||||||
|
FORCE="$1"
|
||||||
|
|
||||||
echo "*** Running cronjob @ `date` ***"
|
echo "*** Running cronjob @ `date` ***"
|
||||||
|
|
||||||
# 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"
|
||||||
status="$?"
|
status="$?"
|
||||||
echo "* Pull status is '$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."
|
echo "* Site is already up to date and copied, exiting."
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
@@ -16,7 +18,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.
|
||||||
hugo --gc --minify
|
hugo --gc --minify
|
||||||
status="$?"
|
status="$?"
|
||||||
echo "* Hugo status is '$status'."
|
echo "* Hugo status is '$status', FORCE is '$FORCE'."
|
||||||
if [[ $status == 0 && -e public/index.html ]]; then
|
if [[ $status == 0 && -e public/index.html ]]; then
|
||||||
echo "* Copying files..."
|
echo "* Copying files..."
|
||||||
rm -rfv /var/www/html/*
|
rm -rfv /var/www/html/*
|
||||||
@@ -24,3 +26,7 @@ if [[ $status == 0 && -e public/index.html ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
ww/html/
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
* * * * * www-data /var/www/hugo/cronjob.sh
|
01-59 * * * * www-data /var/www/hugo/cronjob.sh
|
||||||
|
00 * * * * www-data /var/www/hugo/cronjob.sh force
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ if [[ "$DEV" == "Y"* || "$DEV" == "T"* ]]; then
|
|||||||
echo "* Dev server not detected, starting..."
|
echo "* Dev server not detected, starting..."
|
||||||
cd $SITE
|
cd $SITE
|
||||||
killall hugo 2>/dev/null
|
killall hugo 2>/dev/null
|
||||||
sudo -u www-data hugo server -D --noBuildLock --bind 0.0.0.0 -p 1380 &
|
sudo -u www-data hugo server -D -F --noBuildLock --bind 0.0.0.0 -p 1380 &
|
||||||
fi
|
fi
|
||||||
sleep 30
|
sleep 30
|
||||||
done &
|
done &
|
||||||
|
|||||||
Reference in New Issue
Block a user