ansible-roles/library/roles/letsencrypt-acme-sh-client/files/acme-sh-request-cert

39 lines
935 B
Plaintext
Raw Normal View History

2018-08-20 19:19:56 +02:00
#!/bin/bash
if [ -f "/etc/default/acme_sh_request_env" ] ; then
. "/etc/default/acme_sh_request_env"
else
exit 1
fi
if [ -f "$ACME_SH_ENV_FILE" ] ; then
. "$ACME_SH_ENV_FILE"
else
exit 1
fi
RETVAL=
if [ ! -f "$ACME_SH_CONFIG_HOME/ok_certificate_issued" ] ; then
# First request. Try to shut down all the services running on port 80
if [ -x /bin/systemctl ] ; then
/bin/systemctl stop nginx >/dev/null 2>&1
/bin/systemctl stop apache2 >/dev/null 2>&1
/bin/systemctl stop httpd >/dev/null 2>&1
else
service nginx stop
service apache2 stop
service httpd stop
fi
$ACME_SH_BIN $ACME_SH_FIRST_CERT_REQUEST > "$ACME_SH_ISSUE_LOG_FILE" 2>&1
RETVAL=$?
2019-10-30 10:32:41 +01:00
else
$ACME_SH_BIN $ACME_SH_ISSUE_CERT_REQUEST > "$ACME_SH_ISSUE_LOG_FILE" 2>&1
RETVAL=$?
fi
if [ $RETVAL -eq 0 ] ; then
2018-08-20 19:19:56 +02:00
touch "$ACME_SH_CONFIG_HOME/ok_certificate_issued"
fi
exit $RETVAL