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

A

Avnesh Shakya

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
 
C

Cameron Simpson

| 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,
 
J

Jason Friedman

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,481
Members
44,900
Latest member
Nell636132

Latest Threads

Top