mirror of
https://github.com/frappe/bench.git
synced 2025-01-23 15:08:24 +00:00
Merge pull request #868 from Thunderbottom/cron-fix
fix(cron): change cron command for renewing ssl
This commit is contained in:
commit
63737e3bae
@ -81,7 +81,7 @@ def run_certbot_and_setup_ssl(site, custom_domain, bench_path, interactive=True)
|
|||||||
|
|
||||||
|
|
||||||
def setup_crontab():
|
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)
|
system_crontab = CronTab(tabfile='/etc/crontab', user=True)
|
||||||
if job_command not in str(system_crontab):
|
if job_command not in str(system_crontab):
|
||||||
job = system_crontab.new(command=job_command, comment="Renew lets-encrypt every month")
|
job = system_crontab.new(command=job_command, comment="Renew lets-encrypt every month")
|
||||||
@ -148,9 +148,9 @@ def setup_wildcard_ssl(domain, email, bench_path, exclude_base_domain):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
exec_cmd("{path} certonly --manual --preferred-challenges=dns {email_param} \
|
exec_cmd("{path} certonly --manual --preferred-challenges=dns {email_param} \
|
||||||
--server https://acme-v02.api.letsencrypt.org/directory \
|
--server https://acme-v02.api.letsencrypt.org/directory \
|
||||||
--agree-tos -d {domain}".format(path=get_certbot_path(), domain=' -d '.join(domain_list),
|
--agree-tos -d {domain}".format(path=get_certbot_path(), domain=' -d '.join(domain_list),
|
||||||
email_param=email_param))
|
email_param=email_param))
|
||||||
|
|
||||||
except CommandFailedError:
|
except CommandFailedError:
|
||||||
print("There was a problem trying to setup SSL")
|
print("There was a problem trying to setup SSL")
|
||||||
@ -161,7 +161,7 @@ def setup_wildcard_ssl(domain, email, bench_path, exclude_base_domain):
|
|||||||
"wildcard": {
|
"wildcard": {
|
||||||
"domain": domain,
|
"domain": domain,
|
||||||
"ssl_certificate": os.path.join(ssl_path, "fullchain.pem"),
|
"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")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,4 +171,4 @@ def setup_wildcard_ssl(domain, email, bench_path, exclude_base_domain):
|
|||||||
make_nginx_conf(bench_path)
|
make_nginx_conf(bench_path)
|
||||||
print("Restrting Nginx service")
|
print("Restrting Nginx service")
|
||||||
service('nginx', 'restart')
|
service('nginx', 'restart')
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user