Re: How to start AP?

66 views
Skip to first unread message

Robert Forkel

unread,
Mar 21, 2012, 11:55:28 AM3/21/12
to apsch...@googlegroups.com
as far as i understand, APScheduler is meant to be used within
long-running apps like an app server.

On Wed, Mar 21, 2012 at 4:51 PM, Nelson Jones <huawe...@gmail.com> wrote:
> I wrote a simple script.
> from datetime import date
> from apscheduler.scheduler import Scheduler
>
> # Define the function that is to be executed
> def my_job(text):
>    print text
>
> # Start the scheduler
> sched = Scheduler()
> sched.start()
>
> # The job will be executed on November 6th, 2009
> exec_date = date(2019, 11, 6)
>
> # Store the job in a variable in case we want to cancel it
> job = sched.add_date_job(my_job, exec_date, ['text'])
>
> It will exit.
> I had to write a mutithreaded code and put the above logic in the
> child thread and force the main thread the loop.
> Is there more elegant way to deamonize the AP?
>
> Thanks,

Reply all
Reply to author
Forward
0 new messages