defined(my $pid = fork) or die "Can't fork: $!\n"; exit if $pid; setsid or die "Can't start a new session: $!\n"; $SIG{'HUP'} = $SIG{'INT'} = $SIG{'KILL'} = $SIG{'TERM'} = &sig_handler; my $connection_log = "/var/log/qmail/qmail-smtpd/current"; if(-e $connection_log){ my $file = File::Tail->new($connection_log); my $line; while (defined($line = $file->read)) { print "Line contents: $line\n"; } } sub sig_handler { my $sig = shift; print "Received SIG $sig\n"; quit(0); }