Create cron1m.py
This commit is contained in:
21
onedrive/cron/cron1m.py
Normal file
21
onedrive/cron/cron1m.py
Normal 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(1).minutes.do(ejecutar_comando)
|
||||
|
||||
while True:
|
||||
# Ejecuta las tareas pendientes
|
||||
schedule.run_pending()
|
||||
|
||||
# Espera 1 segundo antes de volver a verificar
|
||||
time.sleep(1)
|
||||
Reference in New Issue
Block a user