diff --git a/Config/HugoExample/files/hugo.cronjob.sh b/Config/HugoExample/files/hugo.cronjob.sh index 8bb86b7..0e215bc 100644 --- a/Config/HugoExample/files/hugo.cronjob.sh +++ b/Config/HugoExample/files/hugo.cronjob.sh @@ -2,9 +2,10 @@ cd /var/www/hugo/site -git pull +git pull && hugo --gc --minify +status="$?" -hugo --gc --minify - -rm -rfv /var/www/html/* -cp -rfv public/* /var/www/html/ +if [[ $status == 0 && -e public/* ]]; then + rm -rfv /var/www/html/* + mv -rfv public/* /var/www/html/ +fi