I am trying to schedule a python script(function) that get's data from a database (source DB) and dump them into an S3 bucket(destination DB). This would be used in production and I want a schedule that triggers this job to run at a particular time every day without human intervention. Please how do I go about this.
I have tried using this sample code below and this tends to stop if my PC goes off and maybe restart when I run the code again, this is not what I want.
"""
Demonstrates how to use the blocking scheduler to schedule a job that executes on 3 second
intervals.
"""
from datetime import datetime
import os
from apscheduler.schedulers.blocking import BlockingScheduler
def tick():
print('Tick! The time is: %s' % datetime.now())
if __name__ == '__main__':
scheduler = BlockingScheduler()
scheduler.add_job(tick, 'interval', seconds=3)
print('Press Ctrl+{0} to exit'.format('Break' if os.name == 'nt' else 'C'))
try:
scheduler.start()
except (KeyboardInterrupt, SystemExit):
pass