2
0
mirror of https://github.com/frappe/bench.git synced 2025-02-07 13:18:24 +00:00

fix: setup cron job for renewing ssl certificate (#918)

* fix: setup cronjob for renewing ssl certificate

cronjob set for 1st of every month

* fix: cannonical PYPI package name updates

    refs:
    - https://pypi.org/project/python-crontab/
    - https://github.com/frappe/bench/pull/918#issuecomment-589961301
This commit is contained in:
gavin 2020-02-24 12:09:24 +05:30 committed by GitHub
parent d58fc11b3d
commit 92d2fbdc13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 5 deletions

View File

@ -83,11 +83,10 @@ 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 -a nginx --post-hook "systemctl reload nginx"' job_command = '/opt/certbot-auto renew -a nginx --post-hook "systemctl reload nginx"'
system_crontab = CronTab(tabfile='/etc/crontab', user=True) 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.every().month() job.day.on(1)
job.enable()
system_crontab.write() system_crontab.write()

View File

@ -2,7 +2,7 @@ Click==7.0
GitPython==2.1.11 GitPython==2.1.11
honcho==1.0.1 honcho==1.0.1
Jinja2==2.10.3 Jinja2==2.10.3
python_crontab==2.4.0 python-crontab==2.4.0
requests==2.22.0 requests==2.22.0
semantic_version==2.8.2 semantic_version==2.8.2
setuptools==40.8.0 setuptools==40.8.0