forked from JeannieStudio/all_install
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RST.sh
46 lines (45 loc) · 1.89 KB
/
RST.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
RED="\033[0;31m"
NO_COLOR="\033[0m"
GREEN="\033[32m\033[01m"
BLUE="\033[0;36m"
green(){
echo -e "\033[32m\033[01m$1\033[0m"
}
if [[ -f "/etc/shadowsocks-r/ssr_info" ]]; then
shadowsockspwd=`sed -n "1p" /etc/shadowsocks-r/ssr_info`
domainname=`sed -n "5p" /etc/shadowsocks-r/ssr_info`
fi
if [[ -f "/etc/v2ray/v2ray_info" ]]; then
domainname=`sed -n "2p" /etc/v2ray/v2ray_info`
id=`sed -n "1p" /etc/v2ray/v2ray_info`
fi
if [[ -f "/usr/local/etc/trojan/trojan_info" ]]; then
password=`sed -n "1p" /usr/local/etc/trojan/config.json`
domainname=`sed -n "2p" /usr/local/etc/trojan/trojan_info`
fi
if [ -f "/usr/sbin/nginx" ]; then
/usr/bin/certbot renew
sleep 2
/usr/sbin/nginx -s stop
sleep 2
/usr/sbin/nginx
fi
end_time=$(echo | openssl s_client -servername $domainname -connect $domainname:443 2>/dev/null | openssl x509 -noout -dates |grep 'After'| awk -F '=' '{print $2}'| awk -F ' +' '{print $1,$2,$4 }' )
#while [ "${end_time}" = "" ]; do
# end_time=$(echo | openssl s_client -servername $domainname -connect $domainname:443 2>/dev/null | openssl x509 -noout -dates |grep 'After'| awk -F '=' '{print $2}'| awk -F ' +' '{print $1,$2,$4 }' )
#done
end_times=$(date +%s -d "$end_time")
now_time=$(date +%s -d "$(date | awk -F ' +' '{print $2,$3,$6}')")
RST=$(($((end_times-now_time))/(60*60*24)))
if [ "${end_time}" != "" ]; then
if [[ -f "/etc/shadowsocks-r/ssr_info" ]]; then
sed -i "/<li>证书有效期剩余天数/c <li>证书有效期剩余天数:${RST}</li>" /var/www/${shadowsockspwd}.html
fi
if [[ -f "/etc/v2ray/v2ray_info" ]]; then
sed -i "/<li>证书有效期剩余天数/c <li>证书有效期剩余天数:${RST}</li>" /var/www/${id}.html
fi
if [[ -f "/usr/local/etc/trojan/trojan_info" ]]; then
sed -i "/<li>证书有效期剩余天数/c <li>证书有效期剩余天数:${RST}</li>" /var/www/${password}.html
fi
fi