I would like to run a python script during the night and so I was thinking of using APScheduler. I'll start running it at 1am of the following night and it will run once every night
my scheduler script looks like this (scheduler.py):
from apscheduler.scheduler import Scheduler
from datetime import datetime, timedelta, time, date
if __name__ == '__main__':
sched = Scheduler()
startDate = datetime.combine(date.today() + timedelta(days=1),time(1))
sched.add_interval_job(myScript, start_date = startDate, days=1)
python myScheduler.py & disown
kill -9 PID
you have to keep the script running otherwise after the
sched.add_interval_job(myScript, start_date = startDate, days=1), the script ends and stop.
import time while True: time.sleep(10) sched.shutdown()
after, and then, the scheduler will still be alive.