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.
This commit is contained in:
2017-02-09 20:39:42 +01:00
parent 840573ffd3
commit ea899521e7
+8
View File
@@ -1,6 +1,12 @@
#!/bin/bash #!/bin/bash
PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin 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 for a random time so not all certificates get renewed at the same time
sleep 473 sleep 473
@@ -12,3 +18,5 @@ if [ \$? != 0 ]; then
# import certificate # import certificate
uberspace-add-certificate -k ~/.config/letsencrypt/live/${domain}/privkey.pem -c ~/.config/letsencrypt/live/${domain}/cert.pem uberspace-add-certificate -k ~/.config/letsencrypt/live/${domain}/privkey.pem -c ~/.config/letsencrypt/live/${domain}/cert.pem
fi fi
done