2
0
mirror of https://github.com/frappe/bench.git synced 2024-09-24 13:09:01 +00:00

fix: removed force renewal as it would extend by 3 months every month, now the job runs daily

This commit is contained in:
Abhishek Balam 2020-09-09 19:38:18 +05:30
parent ac2afb32da
commit 408676c80e
2 changed files with 5 additions and 5 deletions

View File

@ -86,11 +86,11 @@ def run_certbot_and_setup_ssl(site, custom_domain, bench_path, interactive=True)
def setup_crontab(): def setup_crontab():
job_command = '/opt/certbot-auto renew --force-renewal -a nginx --post-hook "systemctl reload nginx"' job_command = '/opt/certbot-auto renew -a nginx --post-hook "systemctl reload nginx"'
system_crontab = CronTab(user='root') system_crontab = CronTab(user='root')
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")
job.setall('0 0 1 * *') # Run at 00:00 on every day-of-month 1 job.setall('0 0 */1 * *') # Run at 00:00 every day-of-month
system_crontab.write() system_crontab.write()

View File

@ -7,13 +7,13 @@ def execute(bench_path):
This patch fixes a cron job that would renew letsencrypt certificate This patch fixes a cron job that would renew letsencrypt certificate
""" """
job_command = '/opt/certbot-auto renew --force-renewal -a nginx --post-hook "systemctl reload nginx"' job_command = '/opt/certbot-auto renew -a nginx --post-hook "systemctl reload nginx"'
system_crontab = CronTab(user='root') system_crontab = CronTab(user='root')
job_comment = "Renew lets-encrypt every month" job_comment = "Renew lets-encrypt every month"
for job in system_crontab.find_comment(job_comment) for job in system_crontab.find_comment(job_comment):
system_crontab.remove(job) system_crontab.remove(job)
job = system_crontab.new(command=job_command, comment=job_comment) job = system_crontab.new(command=job_command, comment=job_comment)
job.setall('0 0 1 * *') # Run at 00:00 on every day-of-month 1 job.setall('0 0 */1 * *') # Run at 00:00 every day-of-month
system_crontab.write() system_crontab.write()
break break