|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Running a perl file every 6 second interval
Hii
I have a perl script which i need to run at every 6 seconds interval.I know i can run it from a cron file but it only starts from minutes.there is no scope for running the file in seconds. Any help will be greatly appreciated. Regards Arnab |
|
#2
|
||||
|
||||
|
How about writing a second perl script that has a while {} loop that never ends, and in every iteration it checks the time, sees if 6 more seconds have passed, and if so, executes the other perl file?
|
|
#3
|
|||
|
|||
|
thankx for ur suggession,Actually i hav also tried the same thing ,but i found that running an infinite while loop makes my system ie PC hanged after 10-15 minutes and nothing else can be done on it after restart.
Does anybody know abt any other scheduler apart frm cron which runs on Linux. Thaking You, Arnab |
|
#4
|
|||
|
|||
|
Quote:
All the schedulers that I know of (including atd) only resolve the minutes, not seconds. It sounds like your script is consuming resources each time it runs and not releasing them, so you need to be careful about what you initialize within your loop. Also, having an infinate loop running at full speed without any delays is going to consume resources. It is easy in perl to put in a sleep command in your infinite loop: sleep 6; Which would make your loop wait for 6 seconds before execuing again AFTER the end of the previous loop. Of course you need to start the program to run nohup in the background, or have it start automatically when you boot your system. |
|
#5
|
|||
|
|||
|
Just out of curiosity ... what needs to be run this often? Sounds like something you'd almost be better off coding a real full-fledged daemon for (if indeed the "run every 6 seconds" solution is the best one).
|
|
#6
|
|||
|
|||
|
Possible solution- have cron run the script every .1 minutes (6 seconds)
|
|
#7
|
|||
|
|||
|
solved
probelm solved .i hav written a shell script where i am calling the perl file for 4 times with a interval of 15 seconds(using sleep 15)and then calling the shellel script from cron.thus the file is executing at 15 seconds interval.
thankx for all ur help and suggesstions regards Arnab |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > Linux Help > Running a perl file every 6 second interval |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|