From ea899521e73ea9b1c5e8cb775a5e7beb9c568198 Mon Sep 17 00:00:00 2001 From: Jonathan Golder Date: Thu, 9 Feb 2017 20:39:42 +0100 Subject: [PATCH] Loop over all existing domain config files To get all domains configured for letsencrypt we loop over all configfiles matching cli-*.ini. Then strip out the domain. --- letsencrypt-renew.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/letsencrypt-renew.sh b/letsencrypt-renew.sh index 74bfc8e..e5d4405 100755 --- a/letsencrypt-renew.sh +++ b/letsencrypt-renew.sh @@ -1,6 +1,12 @@ #!/bin/bash PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin +# Get all existing inifiles matching namescheme cli-${domain}.ini +for inifile in cli-*.ini; do + + # Strip domain out of filename + domain=${inifile:4:-4} + # sleep for a random time so not all certificates get renewed at the same time sleep 473 @@ -12,3 +18,5 @@ if [ \$? != 0 ]; then # import certificate uberspace-add-certificate -k ~/.config/letsencrypt/live/${domain}/privkey.pem -c ~/.config/letsencrypt/live/${domain}/cert.pem fi + +done