mirror of
https://github.com/frappe/bench.git
synced 2024-11-12 00:06:36 +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:
commit
a73d38851b
@ -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
|
||||||
|
15
bench/patches/v5/fix_backup_cronjob.py
Normal file
15
bench/patches/v5/fix_backup_cronjob.py
Normal 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()
|
@ -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()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user