top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

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

0 votes
383 views

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.

posted May 20, 2013 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote
 
Best answer

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?

answer May 20, 2013 by anonymous
Similar Questions
+5 votes

I am building my script. I want to run all the test scripts.

Currently I am running the code "python setup.py test", it is running only the some tests in my directory. I want to run all the tests in my directory.

0 votes

I am running a python script and it will create a file name like filename0.0.0 and If I run it again then new file will create one more like filename0.0.1......
my code is-

i = 0
for i in range(1000):
 try:
 with open('filename%d.%d.%d.json'%(0,0,i,)): pass
 continue
 except IOError:
 dataFile = file('filename%d.%d.%d.json'%(0,0,i,), 'a+')
 break

But It will take more time after creating many files, So i want to store value of last var "i" in a variable so that when I run my script again then I can use it. for example-
my last created file is filename0.0.27 then it should store 27 in a variable and when i run again then new file should be created 0.0.28 according to last value "27", so that i could save time and it can create file fast..

+3 votes

I have a python script that is currently run from cron. We want to make it into a service so it can be controlled with service start/stop/restart.
Can anyone point me at site that has instructions on how to do this?

0 votes

How can write a python script which will execute some perl scripts in a gui and shouldn't be post processed....?

+3 votes

I am trying to count the number of files in a folder with python script but not getting the appropriate script. In which I can change the path and can find out the count of other folder files.

It doesn't matter for me how long the script is but need the clear script and it would be better if you can explain it also.

...