LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-24-2012, 05:36 AM   #1
Tyron Babu
LQ Newbie
 
Registered: Jan 2012
Posts: 2

Rep: Reputation: Disabled
Perl script doesn't respond for more than 10 Hours


This Perl script can run in endless loop with random number of sleep time until user abort (like CTRL + C)

code:
$| = 1;
if($loginStatus==2){ $successCounter++;
aSleep();
}
else{
$failedCounter++;
aSleep();
}
print STLOG_FILE "[".DateAndTime()."] - $failedCounter -Attempts Failed\n\n";
print $failedCounter."- Attempts Failed \n\n";


#aSleep()

sub aSleep(){
$| = 1;
my $dT=DateAndTime();
my $WAIT_TIME;
print "\n Time ".qx(date /T)." ".qx(time /T)."\n";
print STLOG_FILE "[".DateAndTime()."] - :Time :".qx(date /T)." ".qx(time /T)."\n";

$WAIT_TIME=scalar((rand()*200)+30);

print STLOG_FILE "[".DateAndTime()."] - Waiting (in Seconds)....".$WAIT_TIME."\n\n";
print "\n\n Waiting (in Seconds)....".$WAIT_TIME."\n\n";

sleep($WAIT_TIME);
return 0;
}

this script runs fine for 4 Hours, later it takes 10-15 Hours to return from aSleep() and print statements. I see this behavior in logs.It checks status in MIB browser and also has to access remote device.
Main concern : If I have entries in log from 6PM to 9PM of Monday, then continuation in log is on Tuesday at 9 AM or so.

Last edited by Tyron Babu; 01-24-2012 at 06:05 AM. Reason: Adding more information
 
Old 01-25-2012, 11:23 PM   #2
timetraveler
Member
 
Registered: Apr 2010
Posts: 243
Blog Entries: 2

Rep: Reputation: 31
Tyron Babu,
These are linux forums and you may have better luck finding an answer on a windows forum. Which windows version of perl do you run?
 
1 members found this post helpful.
Old 01-26-2012, 11:40 PM   #3
Tyron Babu
LQ Newbie
 
Registered: Jan 2012
Posts: 2

Original Poster
Rep: Reputation: Disabled
Thnks 4 advice...perl version 5.14.2
 
  


Reply



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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Why does it take 3 hours for the terminal to respond to lspci command? AlastairSC Linux - Newbie 3 01-07-2010 09:27 AM
Server aburptly stops running High CPU usage PERL script after about 5 hours bpmee Linux - Server 3 05-18-2007 11:24 AM
Keyboard doesn't respond secret_force Ubuntu 3 08-03-2006 01:38 PM
A Perl script doesn't properly work Hirszu Programming 4 11-29-2005 01:02 AM
GRUB doesn't respond n0va Linux - Newbie 3 08-06-2005 11:18 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration