How can I re-run a script every x hours?
My command - streamlit run main.py
My attempts - run_script.py
import schedule
import time
import os
# run command
def job():
os.system('streamlit run ../main.py')
# schedule everyday
schedule.every(10).seconds.do(job)
print('run')
# keep running
while 1:
schedule.run_pending()
time.sleep(1)
This script runs fine but doesn’t update new entries from the database. I have to manually stop and start to see the changes.
Second attempt
Not sure how to use this script.
Folder structure
main folder
scheduler folder
run_script.py
main.py
Wish to trigger main.py from the run_script.py. Thank you.