2
0
mirror of https://github.com/frappe/bench.git synced 2024-11-12 00:06:36 +00:00

Merge branch 'letsencyrpt-renew' of https://github.com/abhishekbalam/bench into letsencyrpt-renew

This commit is contained in:
Abhishek Balam 2020-09-08 13:06:22 +05:30
commit ac2afb32da

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 --force-renewal -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 on every day-of-month 1
system_crontab.write() system_crontab.write()
break break