From 2117cfb91bb99a30bcba660cea0df0d041a8146e Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Fri, 2 Aug 2024 15:35:46 +0200 Subject: [PATCH] add new schedule --- app/primary_cron_job.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/primary_cron_job.py b/app/primary_cron_job.py index db68db2..bd03bf1 100755 --- a/app/primary_cron_job.py +++ b/app/primary_cron_job.py @@ -171,7 +171,10 @@ def run_cron_portfolio(): def run_cron_options_flow(): week = datetime.today().weekday() - if week <= 4: + current_time = datetime.now().time() + start_time = time(15, 30) # 15:30 + end_time = time(22, 0) # 22:00 + if week <= 4 and start_time <= current_time < end_time: run_command(["python3", "cron_options_flow.py"]) command = [ @@ -184,7 +187,10 @@ def run_cron_options_flow(): def run_cron_options_zero_dte(): week = datetime.today().weekday() - if week <= 4: + current_time = datetime.now().time() + start_time = time(15, 30) # 15:30 + end_time = time(22, 0) # 22:00 + if week <= 4 and start_time <= current_time < end_time: run_command(["python3", "cron_options_zero_dte.py"]) command = [ "sudo", "rsync", "-avz", "-e", "ssh",