Is there a way to schedule my script?

John Gordon gordon at panix.com
Wed Dec 17 14:41:33 EST 2014


In <mailman.17010.1418843457.18130.python-list at python.org> Juan Christian <juan0christian at gmail.com> writes:

> --047d7b874b2c1e67eb050a6e3cc4
> Content-Type: text/plain; charset=UTF-8

> I know about the schedule modules and such but they work in situations like
> 'run this in a X hours/minutes/seconds interval', I already have my code in
> a while loop with sleep (it's a bit ugly, I'l change to a scheduler soon).

> What I really want is, for example:

> 24/7/365
> 9:00 AM -> Start
> 11:59 PM -> Stop

> 9:00 AM ~ 11:50 PM -> Running
> 12:00 AM ~ 8:59 AM -> Stopped

> I want my script to start at a given time and stop at another given time,
> is that possible?

You could write a separate program whose only job is to send a STOP or
CONTINUE signal to your main program, and then run that program from a
scheduler.

The standard system "kill" command would probably work for this purpose,
assuming you have access to your main program's process ID.

-- 
John Gordon         Imagine what it must be like for a real medical doctor to
gordon at panix.com    watch 'House', or a real serial killer to watch 'Dexter'.




More information about the Python-list mailing list