2
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
#!/usr/bin/env sh
|
||||
set -eu
|
||||
|
||||
# 日常续期用:
|
||||
# certbot renew 会自己判断证书是否快过期;没到续期时间不会真正重签。
|
||||
# renew 成功或无须续期后,重载 OpenResty,让已经更新的证书生效。
|
||||
# Renew certificates when needed, then reload OpenResty.
|
||||
|
||||
ROOT_DIR="$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)"
|
||||
|
||||
@@ -11,16 +9,16 @@ cd "$ROOT_DIR"
|
||||
|
||||
. "$ROOT_DIR/scripts/lib-compose.sh"
|
||||
|
||||
echo "按需续期证书..."
|
||||
echo "Renewing certificates if needed..."
|
||||
compose run --rm --entrypoint certbot certbot \
|
||||
renew --webroot -w /var/www
|
||||
|
||||
echo "重载 OpenResty 以使用续期后的证书..."
|
||||
echo "Reloading OpenResty..."
|
||||
if compose exec -T openresty openresty -s reload; then
|
||||
echo "OpenResty 已重载。"
|
||||
echo "OpenResty reloaded."
|
||||
else
|
||||
echo "重载失败,改为重启 OpenResty..."
|
||||
echo "Reload failed; restarting OpenResty..."
|
||||
compose restart openresty
|
||||
fi
|
||||
|
||||
echo "完成。"
|
||||
echo "Done."
|
||||
|
||||
Reference in New Issue
Block a user