@@ -474,17 +474,14 @@ ssl_cert_issue_standalone() {
474
474
certPath=/root/cert
475
475
if [ ! -d " $certPath " ]; then
476
476
mkdir $certPath
477
- else
478
- rm -rf $certPath
479
- mkdir $certPath
480
477
fi
481
478
# get the domain here,and we need verify it
482
479
local domain=" "
483
480
read -p " please input your domain:" domain
484
481
LOGD " your domain is:${domain} ,check it..."
485
482
# 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
488
485
local certInfo=$( ~/.acme.sh/acme.sh --list)
489
486
LOGE " system already have certs here,can not issue again,current certs details:"
490
487
LOGI " $certInfo "
@@ -512,8 +509,8 @@ ssl_cert_issue_standalone() {
512
509
fi
513
510
# install cert
514
511
~ /.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
517
514
518
515
if [ $? -ne 0 ]; then
519
516
LOGE " install certs failed,exit"
@@ -556,16 +553,13 @@ ssl_cert_issue_by_cloudflare() {
556
553
certPath=/root/cert
557
554
if [ ! -d " $certPath " ]; then
558
555
mkdir $certPath
559
- else
560
- rm -rf $certPath
561
- mkdir $certPath
562
556
fi
563
557
LOGD " please input your domain:"
564
558
read -p " Input your domain here:" CF_Domain
565
559
LOGD " your domain is:${CF_Domain} ,check it..."
566
560
# 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
569
563
local certInfo=$( ~/.acme.sh/acme.sh --list)
570
564
LOGE " system already have certs here,can not issue again,current certs details:"
571
565
LOGI " $certInfo "
@@ -595,8 +589,8 @@ ssl_cert_issue_by_cloudflare() {
595
589
LOGI " issue cert succeed,installing..."
596
590
fi
597
591
~ /.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
600
594
if [ $? -ne 0 ]; then
601
595
LOGE " install cert failed,exit"
602
596
rm -rf ~ /.acme.sh/${CF_Domain}
0 commit comments