20 lines
706 B
Bash
Executable File
20 lines
706 B
Bash
Executable File
#!/bin/bash
|
|
|
|
if [ "$1" == "certbot" ]; then
|
|
certbot renew -q --config-dir /etc/nginx/conf.d/ssl/letsencrypt/ --renew-hook "/usr/sbin/nginx -s reload"
|
|
|
|
elif [ "$1" == "lego" ]; then
|
|
LEGO_ACCOUNT_EMAIL=${LEGO_ACCOUNT_EMAIL:? LEGO_ACCOUNT_EMAIL not set}
|
|
LEGO_CERT_DOMAIN=${LEGO_CERT_DOMAIN:? LEGO_CERT_DOMAIN not set}
|
|
|
|
LEGO_CERT_DOMAIN=("${LEGO_CERT_DOMAIN[@]/#/--domains=\"}")
|
|
if [ -n "${LEGO_CERT_DOMAIN}" ]; then
|
|
LEGO_CERT_DOMAIN=${LEGO_CERT_DOMAIN:+"${LEGO_CERT_DOMAIN[@]/%/\"}"}
|
|
fi
|
|
|
|
echo lego --email="mail@gmail.com" ${LEGO_CERT_DOMAIN} --tls --tls.port 444 renew --renew-hook="/usr/sbin/nginx -s reload"
|
|
|
|
else
|
|
echo "! ERROR: Unknown certbot method [$1]"
|
|
fi
|