Compare commits

...

2 Commits

Author SHA1 Message Date
7c39356bfa Bufixes 2021-09-09 10:03:51 +02:00
ae17f1fecb Minor changes. 2021-09-09 09:27:57 +02:00

View File

@@ -1,7 +1,5 @@
#!/bin/sh
DATE=`date +%F-%H-%M-%S`
email=$EMAIL
start_letsencrypt() {
@@ -16,24 +14,30 @@ start_letsencrypt() {
}
LETSENCRYPT_FILE=$(find /acme.sh/ -type f -name letsencrypt);
if [ -f "$LETSENCRYPT_FILE" ] ; then
DOMAIN=$(jq -r .DOMAIN $LETSENCRYPT_FILE) ;
start_letsencrypt;
rm $LETSENCRYPT_FILE;
else
for i in `ls /domains/` ; do
DOMAIN=$(jq -r .DOMAIN /domains/$i) ;
if [[ -f "/acme.sh/$DOMAIN/key.pem" && -f "/acme.sh/$DOMAIN/fullchain.pem" && -f "/acme.sh/$DOMAIN/cert.pem" ]] ; then
echo "Found certificate files";
start_letsencrypt;
if [[ -n "$(find /acme.sh/$DOMAIN/ -type f -mmin +60)" ]]; then
touch /acme.sh/$DOMAIN/renew_certificate;
fi
else
start_letsencrypt;
touch /acme.sh/$DOMAIN/new_certificate;
fi
done ;
fi
LETSENCRYPT_FILE=$(find /acme.sh/ -type f -name letsencrypt);
if [ -n "$LETSENCRYPT_FILE" ] ; then
DOMAIN=$(jq -r .DOMAIN $LETSENCRYPT_FILE) ;
start_letsencrypt;
rm $LETSENCRYPT_FILE;
else
for i in `ls` ; do
DOMAIN=$(jq -r .DOMAIN $i) ;
if [[ -f /acme.sh/$DOMAIN/key.pem && -f /acme.sh/$DOMAIN/fullchain.pem && -f /acme.sh/$DOMAIN/cert.pem ]] ; then
start_letsencrypt ;
touch /acme.sh/$DOMAIN/renew_certificate;
else
start_letsencrypt;
if [[ -f /acme.sh/$DOMAIN/key.pem && -f /acme.sh/$DOMAIN/fullchain.pem && -f /acme.sh/$DOMAIN/cert.pem ]] ; then
touch /acme.sh/$DOMAIN/new_certificate;
else
while [[ ! -f /acme.sh/$DOMAIN/key.pem || ! -f /acme.sh/$DOMAIN/fullchain.pem || ! -f /acme.sh/$DOMAIN/cert.pem ]] ; do
sleep 10;
start_letsencrypt ;
done
fi
fi
done ;
fi