469,352 Members | 1,668 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,352 developers. It's quick & easy.

ok...

I have written a script that read serial port (under linux). This
is done as per user specified interval. So we have,

while True:
readport()
processreading()
alertusers()
sleep(nseconds)
(the actuall code is more detailed)

I am currently thinking about reading the port and sending alerts
to users as part of a self test. What I am looking for is to specify a
date and time to run the self tests without interfering with anything
else i.e. the rest of the logic is not affected. Is this possible?

P.S. Cron can probably do the job, but I am trying to stick to python.

Jul 18 '05 #1
1 1155
On Tue, 18 Nov 2003 16:02:28 +0200,
us**@domain.invalid <us**@domain.invalid> wrote:
to users as part of a self test. What I am looking for is to specify a
date and time to run the self tests without interfering with anything
else i.e. the rest of the logic is not affected. Is this possible?

P.S. Cron can probably do the job, but I am trying to stick to python.


Why impose that last constraint? It seems much more difficult to write and
debug Python code for cron-like features than to just use cron.

Would your Python code run as a daemon and wait around until it's time to do
something? Then what if it crashes? You'd better implement logging of
errors so that you find out about any problems. What if the system gets
rebooted? You'd better write an /etc/init.d script to start your daemon.

It seems much easier to run 'crontab -e' and type in the following:

# Run the test every morning at 1AM
0 1 * * * /home/amk/test.py

--amk
Jul 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by William C. White | last post: by
2 posts views Thread by Albert Ahtenberg | last post: by
3 posts views Thread by James | last post: by
reply views Thread by Ollivier Robert | last post: by
1 post views Thread by Richard Galli | last post: by
4 posts views Thread by Albert Ahtenberg | last post: by
1 post views Thread by inderjit S Gabrie | last post: by
2 posts views Thread by Jack | last post: by
3 posts views Thread by Sandwick | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.