Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sleep not sleeping

Status
Not open for further replies.

tommycahir1

Programmer
Feb 20, 2004
34
0
0
IE
hi all i trying to put the cgi script to sleep for 60 seconds but it doesnt appear to work as it calls the save_graph function almost immediately..
any ideas on what i have done wrong..

my $index = 1;
while ($index <= $NoOfIf )
{
my $pid = fork();
die "Cannot fork: $!" unless defined($pid);
if ($pid == 0)
{
# Child proces
recieved_packets($now,$then,$index);
exit(0);
}
$index++;
}
my $graphxlabel = "Time";
my $graphylabel = "No. Of Packets Recieved";
my $graphtitle = "No. Of Packets Recieved On Interface No. ";
my $infile = "indata";
sleep(60);
save_graph($graphtitle,$graphxlabel,$graphylabel,$NoOfIf,$infile);
print_graph;

To explain the code above better would be the recieved packets creates a file possibly multiple files if there are more than one process. then the script should sleep for 60 seconds(due to save file trying to read files that werent created yet).then read these created files and save a graph image then print_graph displays these images to screen ..
 
I'm glad you're sorted tommy, can you pinpoint the changes that made a difference?

Mike

Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884

It's like this; even samurai have teddy bears, and even teddy bears get drunk.
 
yea i got rid of the save_graph function and the file business and just copied and pasted the code into the two sent and recieved functions so that they generated the images without reading or writing to a file..
 
ok thx, one to file away I think.

Mike

Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884

It's like this; even samurai have teddy bears, and even teddy bears get drunk.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top