我有一个名为的网站xplosa.com,它有一个有效的 SSL 证书,我通过 bash 脚本应该能够计算剩余天数到期。我知道有很多替代方法可以完成这项工作,但我喜欢使用 Ubuntu bash 。顺便说一句,我正在使用Ubuntu 18.04
这是我的示例逻辑
#!/bin/bash
get_the_cert_expiry_date() {
# command to retrieve the expiry date
}
currentDate="$(date +%Y-%m-%d)"
website="xplosa.com"
certExpDate="$(get_the_cert_expiry_date)"
count=$((currentDate - certExpDate))
echo "remaining days for expiry: ${count}"
Run Code Online (Sandbox Code Playgroud)
get_the_cert_expiry_date