Commit aca0f32d authored by Floreal Cabanettes's avatar Floreal Cabanettes
Browse files

Refactor of crons

parent aef403b4
......@@ -4,4 +4,4 @@ from lib.crons import Crons
crons = Crons()
crons.clear() # Useless but can be useful if the code change in Crons code
crons.clear()
\ No newline at end of file
......@@ -7,13 +7,16 @@ class Crons:
def __init__(self, base_dir=None):
self.base_dir = base_dir
self.my_cron = CronTab(user=getpass.getuser())
self.clear()
def clear(self):
# Remove old crons:
self.my_cron.remove_all(comment="dgenies")
self.my_cron.write()
def start_all(self):
self.clear()
self.init_menage_cron()
def init_menage_cron(self):
"""
Menage cron is launched at 1h00am each day
......
......@@ -47,7 +47,7 @@ app_data = config_reader.get_app_data()
# Crons:
crons = Crons(app_folder)
crons.init_menage_cron()
crons.start_all()
@app.context_processor
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment