diff --git a/createVhosts.sh b/createVhosts.sh index e022c61..296b9a2 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 @@ -216,7 +217,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