Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #45582 > unrolled thread

How to run a python script twice randomly in a day?

Started byAvnesh Shakya <avnesh.nitk@gmail.com>
First post2013-05-19 20:54 -0700
Last post2013-05-20 14:12 +1000
Articles 3 — 3 participants

Back to article view | Back to comp.lang.python


Contents

  How to run a python script twice randomly in a day? Avnesh Shakya <avnesh.nitk@gmail.com> - 2013-05-19 20:54 -0700
    Re: How to run a python script twice randomly in a day? Jason Friedman <jsf80238@gmail.com> - 2013-05-19 22:27 -0600
    Re: How to run a python script twice randomly in a day? Cameron Simpson <cs@zip.com.au> - 2013-05-20 14:12 +1000

#45582 — How to run a python script twice randomly in a day?

FromAvnesh Shakya <avnesh.nitk@gmail.com>
Date2013-05-19 20:54 -0700
SubjectHow to run a python script twice randomly in a day?
Message-ID<8a44bb69-5e8c-4725-a0c8-505b3ecc1d89@googlegroups.com>
hi,
   How to run a python script twice randomly in a day? Actually I want to run my script randomly in a day and twice only. Please help me.. how is it possible.

Thanks

[toc] | [next] | [standalone]


#45583

FromJason Friedman <jsf80238@gmail.com>
Date2013-05-19 22:27 -0600
Message-ID<mailman.1856.1369024044.3114.python-list@python.org>
In reply to#45582
>    How to run a python script twice randomly in a day? Actually I want to run my script randomly in a day and twice only

I can think of two basic approaches.
One, use crontab or some other similar functionality to call it exactly twice.
Two, use crontab or some other similar functionality to call it every
minute, and add code to your script to execute exactly twice.
Which are you preferring?

[toc] | [prev] | [next] | [standalone]


#45584

FromCameron Simpson <cs@zip.com.au>
Date2013-05-20 14:12 +1000
Message-ID<mailman.1857.1369024163.3114.python-list@python.org>
In reply to#45582
On 19May2013 20:54, Avnesh Shakya <avnesh.nitk@gmail.com> wrote:
|    How to run a python script twice randomly in a day? Actually
| I want to run my script randomly in a day and twice only. Please
| help me.. how is it possible.

Do you mean "run twice a day, each at random times"?

If so, do the obvious: at midnight, pick two random times. Sleep
until the first time, run the script, sleep until the second time,
run the script.

There are various ways to do the sleeping and midnight bits; they're
up to you.

Enjoy,
-- 
Cameron Simpson <cs@zip.com.au>

The ZZR-1100 is not the bike for me, but the day they invent "nerf" roads
and ban radars I'll be the first in line......AMCN

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web