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

Discussion in 'Python' started by Avnesh Shakya, May 20, 2013.

  1. 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
     
    Avnesh Shakya, May 20, 2013
    #1
    1. Advertising

  2. On 19May2013 20:54, Avnesh Shakya <> 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 <>

    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
     
    Cameron Simpson, May 20, 2013
    #2
    1. Advertising

  3. > 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?
     
    Jason Friedman, May 20, 2013
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Cameron Simpson
    Replies:
    0
    Views:
    99
    Cameron Simpson
    May 20, 2013
  2. Cameron Simpson
    Replies:
    0
    Views:
    85
    Cameron Simpson
    May 21, 2013
  3. Avnesh Shakya
    Replies:
    0
    Views:
    106
    Avnesh Shakya
    May 21, 2013
  4. Chris Angelico
    Replies:
    2
    Views:
    81
    Chris Angelico
    May 21, 2013
  5. Cameron Simpson
    Replies:
    0
    Views:
    77
    Cameron Simpson
    May 21, 2013
Loading...

Share This Page