diff fullchain
This commit is contained in:
@@ -22,41 +22,38 @@ start_letsencrypt() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_new_cert() {
|
||||||
|
|
||||||
|
#DATE=$(date +%s)
|
||||||
|
if [[ -f /acme.sh/$DOMAIN/key.pem && -f /acme.sh/$DOMAIN/fullchain.pem && -f /acme.sh/$DOMAIN/cert.pem ]] ; then
|
||||||
|
#D1=$(date -r /acme.sh/$DOMAIN/fullchain.pem +%s)
|
||||||
|
#DIFF=$(expr $DATE - $D1);
|
||||||
|
#if [ $DIFF < 3600 ]; then touch /acme.sh/$DOMAIN/new_certificate; fi
|
||||||
|
NEW=$(openssl x509 -in /acme.sh/$DOMAIN/fullchain.pem -fingerprint -noout)
|
||||||
|
if [ "$ORIGINAL" != "$NEW" ]; then
|
||||||
|
touch /acme.sh/$DOMAIN/new_certificate;
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
sending_error_msg $DOMAIN $DATE;
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
LETSENCRYPT_FILE=$(find /acme.sh/ -type f -name letsencrypt);
|
LETSENCRYPT_FILE=$(find /acme.sh/ -type f -name letsencrypt);
|
||||||
if [ -n "$LETSENCRYPT_FILE" ] ; then
|
if [ -n "$LETSENCRYPT_FILE" ] ; then
|
||||||
DOMAIN=$(jq -r .DOMAIN $LETSENCRYPT_FILE) ;
|
DOMAIN=$(jq -r .DOMAIN $LETSENCRYPT_FILE) ;
|
||||||
DATE=$(date +%y%m%d%H)
|
ORIGINAL=$(openssl x509 -in /acme.sh/$DOMAIN/fullchain.pem -fingerprint -noout)
|
||||||
echo $DATE
|
|
||||||
start_letsencrypt;
|
start_letsencrypt;
|
||||||
rm $LETSENCRYPT_FILE;
|
rm $LETSENCRYPT_FILE;
|
||||||
|
|
||||||
if [[ -f /acme.sh/$DOMAIN/key.pem && -f /acme.sh/$DOMAIN/fullchain.pem && -f /acme.sh/$DOMAIN/cert.pem ]] ; then
|
|
||||||
|
|
||||||
if [[ "$(date -r /acme.sh/$DOMAIN/key.pem +%y%m%d%H)" -ge "$DATE" && "$(date -r /acme.sh/$DOMAIN/fullchain.pem +%y%m%d%H)" -ge "$DATE" && "$(date -r /acme.sh/$DOMAIN/cert.pem +%y%m%d%H)" -ge "$DATE" ]] ; then
|
|
||||||
|
|
||||||
touch /acme.sh/$DOMAIN/new_certificate;
|
check_new_cert
|
||||||
else
|
|
||||||
sending_error_msg $DOMAIN $DATE;
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
cd /domains
|
cd /domains
|
||||||
for i in `ls` ; do
|
for i in `ls` ; do
|
||||||
DOMAIN=$(jq -r .DOMAIN $i) ;
|
DOMAIN=$(jq -r .DOMAIN $i) ;
|
||||||
DATE=$(date +%y%m%d%H)
|
ORIGINAL=$(openssl x509 -in /acme.sh/$DOMAIN/fullchain.pem -fingerprint -noout)
|
||||||
echo $DATE
|
|
||||||
start_letsencrypt $DOMAIN;
|
start_letsencrypt $DOMAIN;
|
||||||
|
|
||||||
if [[ -f /acme.sh/$DOMAIN/key.pem && -f /acme.sh/$DOMAIN/fullchain.pem && -f /acme.sh/$DOMAIN/cert.pem ]] ; then
|
check_new_cert
|
||||||
|
|
||||||
if [[ "$(date -r /acme.sh/$DOMAIN/key.pem +%y%m%d%H)" -ge "$DATE" && "$(date -r /acme.sh/$DOMAIN/fullchain.pem +%y%m%d%H)" -ge "$DATE" && "$(date -r /acme.sh/$DOMAIN/cert.pem +%y%m%d%H)" -ge "$DATE" ]] ; then
|
|
||||||
|
|
||||||
touch /acme.sh/$DOMAIN/new_certificate;
|
|
||||||
else
|
|
||||||
sending_error_msg $DOMAIN $DATE;
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
done ;
|
done ;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user