running apschduler in python script as daemon?
<p>I have a <code>job.py</code> which has following code  </p>

<pre><code>import datetime
import logging
import sys
import os

from apscheduler.scheduler import Scheduler
from src.extractors.pExtractor import somejob

def run_job():
    start = datetime.datetime.now()
    logging.debug('Proposal extraction job starting')
    somejob.main()
    end = datetime.datetime.now()
    duration = end - start
    logging.debug('job completed , took ' + str(duration.seconds) + ' seconds')

def main():
    logging.basicConfig(filename='/tmp/pExtractor.log', level=logging.DEBUG,format='%(levelname)s[%(asctime)s]: %(message)s')
    sched = Scheduler()
    sched.start()
    sched.add_interval_job(run_job, minutes=2)

if __name__ == '__main__':
    main()
</code></pre>

<ul>
<li>When I run this on command prompt it exits immediately  </li>
</ul>

<blockquote>
  <p>INFO[2012-04-03 13:31:02,825]: Started thread pool with 0 core threads
  and 20 maximum threads INFO[2012-04-03 13:31:02,827]: Scheduler
  started INFO[2012-04-03 13:31:02,827]: Added job "run_job (trigger:
  cron[minute='2'], next run at: 2012-04-03 14:02:00)" to job store
  "default" INFO[2012-04-03 13:31:02,828]: Shutting down thread pool</p>
</blockquote>

<ul>
<li>How can I makde this run as daemon?  </li>
</ul>

<p>Thank you</p>
