Clean stale certbot data before SSL acquisition attempt
If a previous certbot run created live/archive/renewal dirs but failed to complete, the next attempt would choke on the existing 'live directory'. Now cleans these before each attempt. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -47,6 +47,11 @@ else
|
|||||||
|
|
||||||
echo "Requesting Let's Encrypt certificate for ${DOMAIN}..."
|
echo "Requesting Let's Encrypt certificate for ${DOMAIN}..."
|
||||||
|
|
||||||
|
# Clean stale certbot data from any previous failed attempt
|
||||||
|
rm -rf "/etc/letsencrypt/live/${DOMAIN}" \
|
||||||
|
"/etc/letsencrypt/archive/${DOMAIN}" \
|
||||||
|
"/etc/letsencrypt/renewal/${DOMAIN}.conf" 2>/dev/null || true
|
||||||
|
|
||||||
# Attempt certificate acquisition
|
# Attempt certificate acquisition
|
||||||
if certbot certonly --webroot \
|
if certbot certonly --webroot \
|
||||||
-w /var/www/certbot \
|
-w /var/www/certbot \
|
||||||
|
|||||||
Reference in New Issue
Block a user