From 1c35bb52d3c0328c5c5afb241a4f1f36893a8cac Mon Sep 17 00:00:00 2001 From: mack-a <57424792+mack-a@users.noreply.github.com> Date: Tue, 7 Jul 2020 18:05:18 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E8=84=9A=E6=9C=AC):=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 86a942b..86d2e38 100644 --- a/install.sh +++ b/install.sh @@ -251,16 +251,24 @@ installTLS(){ exit 0 fi echoContent green " Nginx启动成功,TLS配置成功--->\n" + # 增加定时任务定时维护证书 + # reInstallTLS $1 installV2Ray $1 ${customPath} } # 重新安装&更新tls证书 -reloadInstallTLS(){ +reInstallTLS(){ + echoContent yellow "添加定时维护证书" touch /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh + touch /etc/nginx/v2ray-agent-https/backup_crontab.cron + # 定时任务 + echo "40 0 * * * bash /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh" > /etc/nginx/v2ray-agent-https/backup_crontab.cron + # 备份 + crontab -l > /etc/nginx/v2ray-agent-https/backup_crontab.cron echo "#!/usr/bin/env bash" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh echo "domain=$1" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh - echo "modifyTime=`stat test1.am1z.xyz.key|sed -n '6,6p'|awk '{print $2" "$3" "$4" "$5}'`" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh + echo "modifyTime=`stat $1.key|sed -n '6,6p'|awk '{print $2" "$3" "$4" "$5}'`" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh echo "modifyTime=`date +%s -d "${modifyTime}"`" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh echo "currentTime=`date +%s`" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh echo "stampDiff=`expr ${currentTime} - ${modifyTime}`" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh @@ -269,7 +277,16 @@ reloadInstallTLS(){ echo "then" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh echo "nginx -s stop" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh echo "~/.acme.sh/acme.sh --installcert -d ${domain} --fullchainpath /etc/nginx/v2ray-agent-https/${domain}.crt --keypath /etc/nginx/v2ray-agent-https/${domain}.key --ecc >/dev/null" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh + echo "nginx" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh echo "fi" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh + crontab /etc/nginx/v2ray-agent-https/backup_crontab.cron + crontabResult=`crontab -l` + if [[ -z `crontab -l|grep -v grep|grep 'reloadInstallTLS'` ]] + then + echoContent green "添加定时维护证书" + else + echoContent red "添加定时维护证书失败" + fi } # V2Ray