Forums

Scheduled task don't stop running!

Hi all, I scheduled a script to run. It started running at the right time and it runs all the script perfectly but after it finishes the script, I still see on the "Currently running tasks" section of the "Schedule" tab the task is still running... I have the option to kill it but I wanted this to happen automatically!

Do I need to add something on the script itself??

Cheers!

Does your script do anything which might be keeping it alive, such as using subprocess or system() to run external commands? Or does it use threads?

I had a look at the running processes and it looks like they're blocking waiting for input. Is there a input or raw_input call in your script somewhere?

Yeap xD! There was! I'll change it!

Thanks giles!

No problem, glad to help!

Hi, I'm facing similar issue - the scheduled (hourly) task does not stop after execution. What is more, it appears that it restarts and runs again. Here's my code that runs particular scripts:

import os 
import sys 
from pathlib import Path 
scriptPath = 'path' 
for x in os.listdir('/'+scriptPath ):
    try:
        print(x)
        exec(Path(scriptPath + '/' +x).read_text())
        print('done')
    except Exception as e:
        print(e) 
sys.exit()

EDIT: I found a mistake ;)

Ok. Glad you fixed it.