#!/usr/bin/with-contenv sh cd /var/lib/postgresql SAN_DOMAINS=$(/bin/concat-sans) OLD_MOD=$(stat -c %y /var/lib/postgresql/.lego/certificates/${POSTGRES_DOMAIN}.crt) lego \ --accept-tos \ --server="${POSTGRES_CA}" \ --email="${POSTGRES_ACME_EMAIL}" \ --domains="${POSTGRES_DOMAIN}" ${SAN_DOMAINS} \ --dns="${POSTGRES_DNS_PROVIDER}" \ renew --days 30 NEW_MOD=$(stat -c %y /var/lib/postgresql/.lego/certificates/${POSTGRES_DOMAIN}.crt) if [ "${OLD_MOD}" != "${NEW_MOD}" ]; then kill -s TERM $(head -1 ${PGDATA}/postmaster.pid) fi