Create cron7h.py

This commit is contained in:
kadma
2024-01-21 12:24:31 -05:00
committed by GitHub
parent 1bdd88289b
commit 4b8a06abbc

21
onedrive/cron/cron7h.py Normal file
View File

@@ -0,0 +1,21 @@
import os
import schedule
import time
import subprocess
def ejecutar_comando():
comando = os.environ.get('SUPERCOMANDO', default=None)
if comando is not None:
subprocess.run(comando, shell=True)
else:
print("La variable de entorno no tiene un valor definido.")
schedule.every(7).hours.do(ejecutar_comando)
while True:
# Ejecuta las tareas pendientes
schedule.run_pending()
# Espera 1 segundo antes de volver a verificar
time.sleep(1)