the program will keep folking by daemontools

"Linda" <[email protected]>
Newsgroups gmane.comp.djb.syslog
Message-ID <[email protected]>
Hi,

The following is  my test program. It can restart my test program normally after the program exiting. However, if I add "sleep 5;", the daemontools will keep folking the program. I can see a lot of programs running at the same time. Can I use "sleep" in the program if I want to use daemtools to control it?

Linda

====================================
#!/usr/local/bin/perl

use strict;
$|=1;

my $log=$ARGV[0];
if(! $log){
   print "ERR: Please input Log Name!!\n";
   exit 1;
}else{
   $log="/service/$log";
}

my $i=0;
while($i<1000){
open(FH,">>$log");
  print FH "$i\n";
close(FH);
  $i++;
}
print FH "exit!!\n";
exit 0;
=============================
#!/usr/local/bin/perl

use strict;
$|=1;

my $log=$ARGV[0];
if(! $log){
   print "ERR: Please input Log Name!!\n";
   exit 1;
}else{
   $log="/service/$log";
}

my $i=0;
while($i<1000){
open(FH,">>$log");
  print FH "$i\n";
close(FH);
  $i++;
  sleep 5;
}
print FH "exit!!\n";
exit 0;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.