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

Merge pull request #1030 from Alchez/fix-crontab-backups

fix: run backups every 6 hours, rather than every minute per 6 hours
This commit is contained in:
gavin 2020-07-07 16:16:32 +05:30 committed by GitHub
commit a73d38851b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 1 deletions

View File

@ -5,3 +5,4 @@ bench.patches.v4.update_node
bench.patches.v4.update_socketio bench.patches.v4.update_socketio
bench.patches.v4.install_yarn #2 bench.patches.v4.install_yarn #2
bench.patches.v5.fix_user_permissions bench.patches.v5.fix_user_permissions
bench.patches.v5.fix_backup_cronjob

View File

@ -0,0 +1,15 @@
from bench.config.common_site_config import get_config
from crontab import CronTab
def execute(bench_path):
"""
This patch fixes a cron job that would backup sites every minute per 6 hours
"""
user = get_config(bench_path=bench_path).get('frappe_user')
user_crontab = CronTab(user=user)
for job in user_crontab.find_comment("bench auto backups set for every 6 hours"):
job.every(6).hours()
user_crontab.write()

View File

@ -400,7 +400,7 @@ def setup_backups(bench_path='.'):
if job_command not in str(system_crontab): if job_command not in str(system_crontab):
job = system_crontab.new(command=job_command, comment="bench auto backups set for every 6 hours") job = system_crontab.new(command=job_command, comment="bench auto backups set for every 6 hours")
job.hour.every(6) job.every(6).hours()
system_crontab.write() system_crontab.write()