unless(my $pid = fork()) { setsid; exit if $pid; unless(my $otherpid = fork()) { exit if $otherpid; # setsid; open(INFILE, "tail -n 0 -f $log |") || die "Couldn't open file $!"; while(1) { while () { } } } } }