Linux Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsLinux Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 29th, 2003, 01:31 AM
arnab011 arnab011 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 24 arnab011 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old March 29th, 2003, 10:01 AM
telex4's Avatar
telex4 telex4 is offline
Wacky hack
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2001
Location: London, England
Posts: 512 telex4 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 25 m 29 sec
Reputation Power: 8
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?

Reply With Quote
  #3  
Old March 30th, 2003, 10:05 PM
arnab011 arnab011 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 24 arnab011 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #4  
Old March 31st, 2003, 06:59 AM
keyweb keyweb is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Location: Lake Havasu City, AZ
Posts: 11 keyweb User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Quote:
Originally posted by arnab011
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


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.

Reply With Quote
  #5  
Old March 31st, 2003, 07:44 AM
Strike Strike is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2001
Location: Houston, TX
Posts: 383 Strike User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 41 m 27 sec
Reputation Power: 7
Send a message via ICQ to Strike Send a message via AIM to Strike Send a message via Yahoo to Strike
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).
__________________
Debian - because life's too short for worrying.
Best. (Python.) IRC bot. ever.

Reply With Quote
  #6  
Old April 2nd, 2003, 09:44 PM
seitentaisei seitentaisei is offline
All-Around Junkie
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 53 seitentaisei User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 19 sec
Reputation Power: 6
Possible solution- have cron run the script every .1 minutes (6 seconds)

Reply With Quote
  #7  
Old April 2nd, 2003, 10:17 PM
arnab011 arnab011 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 24 arnab011 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsLinux Help > Running a perl file every 6 second interval


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT