@@ -474,17 +474,14 @@ ssl_cert_issue_standalone() {
474474 certPath=/root/cert
475475 if [ ! -d " $certPath " ]; then
476476 mkdir $certPath
477- else
478- rm -rf $certPath
479- mkdir $certPath
480477 fi
481478 # get the domain here,and we need verify it
482479 local domain=" "
483480 read -p " please input your domain:" domain
484481 LOGD " your domain is:${domain} ,check it..."
485482 # here we need to judge whether there exists cert already
486- local currentCert=$( ~/.acme.sh/acme.sh --list | tail -1 | awk ' {print $1} ' )
487- if [ ${currentCert} == ${domain} ]; then
483+ local currentCert=$( ~/.acme.sh/acme.sh --list | grep ${domain} | wc -l )
484+ if [ ${currentCert} -ne 0 ]; then
488485 local certInfo=$( ~/.acme.sh/acme.sh --list)
489486 LOGE " system already have certs here,can not issue again,current certs details:"
490487 LOGI " $certInfo "
@@ -512,8 +509,8 @@ ssl_cert_issue_standalone() {
512509 fi
513510 # install cert
514511 ~ /.acme.sh/acme.sh --installcert -d ${domain} --ca-file /root/cert/ca.cer \
515- --cert-file /root/cert/${domain} .cer --key-file /root/cert/${domain} .key \
516- --fullchain-file /root/cert/fullchain.cer
512+ --cert-file /root/cert/${domain} .cer --key-file /root/cert/${domain} .key \
513+ --fullchain-file /root/cert/fullchain.cer
517514
518515 if [ $? -ne 0 ]; then
519516 LOGE " install certs failed,exit"
@@ -556,16 +553,13 @@ ssl_cert_issue_by_cloudflare() {
556553 certPath=/root/cert
557554 if [ ! -d " $certPath " ]; then
558555 mkdir $certPath
559- else
560- rm -rf $certPath
561- mkdir $certPath
562556 fi
563557 LOGD " please input your domain:"
564558 read -p " Input your domain here:" CF_Domain
565559 LOGD " your domain is:${CF_Domain} ,check it..."
566560 # here we need to judge whether there exists cert already
567- local currentCert=$( ~/.acme.sh/acme.sh --list | tail -1 | awk ' {print $1} ' )
568- if [ ${currentCert} == ${CF_Domain} ]; then
561+ local currentCert=$( ~/.acme.sh/acme.sh --list | grep ${CF_Domain} | wc -l )
562+ if [ ${currentCert} -ne 0 ]; then
569563 local certInfo=$( ~/.acme.sh/acme.sh --list)
570564 LOGE " system already have certs here,can not issue again,current certs details:"
571565 LOGI " $certInfo "
@@ -595,8 +589,8 @@ ssl_cert_issue_by_cloudflare() {
595589 LOGI " issue cert succeed,installing..."
596590 fi
597591 ~ /.acme.sh/acme.sh --installcert -d ${CF_Domain} -d * .${CF_Domain} --ca-file /root/cert/ca.cer \
598- --cert-file /root/cert/${CF_Domain} .cer --key-file /root/cert/${CF_Domain} .key \
599- --fullchain-file /root/cert/fullchain.cer
592+ --cert-file /root/cert/${CF_Domain} .cer --key-file /root/cert/${CF_Domain} .key \
593+ --fullchain-file /root/cert/fullchain.cer
600594 if [ $? -ne 0 ]; then
601595 LOGE " install cert failed,exit"
602596 rm -rf ~ /.acme.sh/${CF_Domain}
0 commit comments