Add safeguards to cron job so that website does not get deleted without having replacement files.
This commit is contained in:
@@ -2,9 +2,10 @@
|
|||||||
|
|
||||||
cd /var/www/hugo/site
|
cd /var/www/hugo/site
|
||||||
|
|
||||||
git pull
|
git pull && hugo --gc --minify
|
||||||
|
status="$?"
|
||||||
hugo --gc --minify
|
|
||||||
|
|
||||||
|
if [[ $status == 0 && -e public/* ]]; then
|
||||||
rm -rfv /var/www/html/*
|
rm -rfv /var/www/html/*
|
||||||
cp -rfv public/* /var/www/html/
|
mv -rfv public/* /var/www/html/
|
||||||
|
fi
|
||||||
|
Reference in New Issue
Block a user