From 322bf2a82d7d356ba2a45f5ef603c82c94612ea4 Mon Sep 17 00:00:00 2001 From: Matthew Saunders Brown Date: Thu, 18 May 2023 16:17:04 -0700 Subject: [PATCH] add check for existing pem file --- bin/letsencrypt-certonly.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/letsencrypt-certonly.sh b/bin/letsencrypt-certonly.sh index 7177258..3027e97 100755 --- a/bin/letsencrypt-certonly.sh +++ b/bin/letsencrypt-certonly.sh @@ -57,7 +57,13 @@ done # check for domain (hostname) if [[ -z $domain ]]; then echo "domain (hostname) is required" - exit + exit 1 +fi + +# check for existing pem file +if [[ -f /etc/ssl/letsencrypt/$domain.pem ]]; then + echo "pem file for $domain already exists" + exit 1 fi # set vars