Correting DATE variable and compare processes. Fixing acme.sh issues
This commit is contained in:
@@ -3,8 +3,6 @@
|
|||||||
email=$EMAIL
|
email=$EMAIL
|
||||||
|
|
||||||
sending_error_msg() {
|
sending_error_msg() {
|
||||||
$1="DOMAIN"
|
|
||||||
$2="DATE"
|
|
||||||
|
|
||||||
echo "there was unsucessfuly created "$DOMAIN" at date: "$DATE;
|
echo "there was unsucessfuly created "$DOMAIN" at date: "$DATE;
|
||||||
}
|
}
|
||||||
@@ -13,30 +11,21 @@ start_letsencrypt() {
|
|||||||
|
|
||||||
mkdir -p /acme.sh/$DOMAIN/ ;
|
mkdir -p /acme.sh/$DOMAIN/ ;
|
||||||
|
|
||||||
ACME_PARAMS="--issue --standalone --keylength 4096 -d $DOMAIN --cert-file /acme.sh/$DOMAIN/cert.pem --key-file /acme.sh/$DOMAIN/key.pem --fullchain-file /acme.sh/$DOMAIN/fullchain.pem"
|
/usr/local/bin/acme.sh -m $email --issue --standalone --keylength 4096 -d $DOMAIN --cert-file /acme.sh/$DOMAIN/cert.pem --key-file /acme.sh/$DOMAIN/key.pem --fullchain-file /acme.sh/$DOMAIN/fullchain.pem
|
||||||
|
|
||||||
if acme.sh --register-account -m $email $ACME_PARAMS | grep 'Already registered' ; then
|
|
||||||
|
|
||||||
acme.sh $ACME_PARAMS ;
|
|
||||||
fi
|
|
||||||
|
|
||||||
#mkdir -p /acme.sh/$DOMAIN/ecc-certs ;
|
|
||||||
|
|
||||||
#acme.sh --issue --standalone --keylength ec-384 -d $DOMAIN --cert-file /acme.sh/$DOMAIN/ecc-certs/cert.pem --key-file /acme.sh/$DOMAIN/ecc-certs/key.pem --fullchain-file /acme.sh/$DOMAIN/ecc-certs/fullchain.pem
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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 +%m%d%m%H)
|
DATE=$(date +%y%m%d%H)
|
||||||
echo $DATE
|
echo $DATE
|
||||||
start_letsencryp $DOMAIN;
|
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 [[ -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 +%m%d%m%H)" == "$DATE" && "$(date -r /acme.sh/$DOMAIN/fullchain.pem +%m%d%m%H)" == "$DATE" && "$(date -r /acme.sh/$DOMAIN/cert.pem +%m%d%m%H)" == "$DATE" ]] ; 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;
|
touch /acme.sh/$DOMAIN/new_certificate;
|
||||||
else
|
else
|
||||||
@@ -47,13 +36,13 @@ 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 +%m%d%m%H)
|
DATE=$(date +%y%m%d%H)
|
||||||
echo $DATE
|
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
|
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 +%m%d%m%H)" == "$DATE" && "$(date -r /acme.sh/$DOMAIN/fullchain.pem +%m%d%m%H)" == "$DATE" && "$(date -r /acme.sh/$DOMAIN/cert.pem +%m%d%m%H)" == "$DATE" ]] ; 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;
|
touch /acme.sh/$DOMAIN/new_certificate;
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user