That'll execute code and sleep for 60 seconds every time. Supposing it
takes 10 seconds for your program to do its funky thang, that's 70 seconds
for each run. The fork doesn't seem to be too helpful in this one, you
might as well just background when you execute the script :) If you wanted
to get into some of that funky forking action you could try something like;
$SIG{CHLD} = 'IGNORE';
while(!$finished) {
sleep(60);
if(!defined($pid=fork())) {
die "Cannot fork: $!\n";
} elsif(!$pid) {
$finished=1;
# do whatever it is you want
}
}
Every 60 seconds you get an extra process which performs your task once,
and then dies. The original will stay attached to your shell the whole while.
Alexander.
> > On Thu, 06 Jul 2000, you wrote:
> > > #!/usr/bin/perl
> > >
> > > fork(&myprog) && die;
> > >
> > > sub myprog {
> > >
> > > while (1 = 1) {
> > >
> > > ...
> > > ....
> > > ....
> > >
> > > sleep(60);
> > >
> > > };
> > >
> > > };
--
SLUG - Sydney Linux Users Group Mailing List - http://www.slug.org.au
To unsubscribe send email to [EMAIL PROTECTED] with
unsubscribe in the text