I have installed Advanced Python Scheduler and created a small script which has some tasks created in it.
from apscheduler.schedulers.blocking import BlockingScheduler
import document
sched = BlockingScheduler()
@sched.scheduled_job('interval', minutes=3)
def timed_job():
print('This job is run every three minutes.')
document.add_collection()
@sched.scheduled_job('cron', day_of_week='mon-fri', hour=17)
def scheduled_job():
print('This job is run every weekday at 5pm.')
sched.start()
Now for simple execution i can start the script in terminal using python clock.py
and it would run fine. But once i close terminal, it's gone.
So, how do i run this script in background? I know for simple tasks python clock.py &
is a way.
But i need to schedule tasks for a web app and want to keep these tasks running for next 1 year or more.
What are the options available in Ubuntu?
How can i run it as daemon or in background?
Is there a way to keep a check of it's progress?