Skip to content

Commit

Permalink
fix(cron): change cron command for renewing ssl
Browse files Browse the repository at this point in the history
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
  • Loading branch information
Thunderbottom committed Dec 5, 2019
1 parent 7798c4b commit 17b4475
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions bench/config/lets_encrypt.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def run_certbot_and_setup_ssl(site, custom_domain, bench_path, interactive=True)


def setup_crontab():
job_command = 'sudo service nginx stop && /opt/certbot-auto renew && sudo service nginx start'
job_command = '/opt/certbot-auto renew -a nginx --post-hook "systemctl reload nginx"'
system_crontab = CronTab(tabfile='/etc/crontab', user=True)
if job_command not in str(system_crontab):
job = system_crontab.new(command=job_command, comment="Renew lets-encrypt every month")
Expand Down Expand Up @@ -148,9 +148,9 @@ def _get_domains(domain):

try:
exec_cmd("{path} certonly --manual --preferred-challenges=dns {email_param} \
--server https://acme-v02.api.letsencrypt.org/directory \
--agree-tos -d {domain}".format(path=get_certbot_path(), domain=' -d '.join(domain_list),
email_param=email_param))
--server https://acme-v02.api.letsencrypt.org/directory \
--agree-tos -d {domain}".format(path=get_certbot_path(), domain=' -d '.join(domain_list),
email_param=email_param))

except CommandFailedError:
print("There was a problem trying to setup SSL")
Expand All @@ -161,7 +161,7 @@ def _get_domains(domain):
"wildcard": {
"domain": domain,
"ssl_certificate": os.path.join(ssl_path, "fullchain.pem"),
"ssl_certificate_key": os.path.join(ssl_path, "privkey.pem")
"ssl_certificate_key": os.path.join(ssl_path, "privkey.pem")
}
}

Expand All @@ -171,4 +171,4 @@ def _get_domains(domain):
make_nginx_conf(bench_path)
print("Restrting Nginx service")
service('nginx', 'restart')

0 comments on commit 17b4475

Please sign in to comment.