diff --git a/createVhosts.sh b/createVhosts.sh index 8b725c4..5894561 100755 --- a/createVhosts.sh +++ b/createVhosts.sh @@ -28,6 +28,7 @@ function usage function get_cert { /root/.acme.sh/acme.sh --issue --domain $_domain --webroot /srv/http-content-combined/ --cert-file /etc/nginx/ssl/${_domain}.crt --key-file /etc/nginx/ssl/${_domain}.key --fullchain-file /etc/nginx/ssl/${_domain}-fullchain.crt + return $? } function reload_nginx @@ -172,7 +173,10 @@ echo "Reloading Nginx..." reload_nginx echo "Retrieving Let's Encrypt Certificate..." -get_cert +if ! get_cert; then + rm $_vhost_conf_file + err "Failed to retrieve certificate!" +fi cat << EOF >> $_vhost_conf_file