#!/usr/bin/perl use POSIX; use warnings; use strict; my $file = "lines.txt"; open(LINES, "<$file"); my @ar_lines = ; print $ar_lines[0]."\n"; foreach my $link (@ar_lines) { print $link."\n"; my $pid = fork(); if($pid == 0){ # Child-Prozess print "Ich bin das Kind: ",$$,"\n"; $SIG{ALRM}=sub{ exit(0) }; alarm(35); system("/usr/bin/firefox ' $link'"); exit(0); } else { # Parent-Prozess print "Ich bin der Vater: ",$$,"\n"; print "Und mein Kind ist: ",$pid,"\n"; # Etwas Ausgabe... my $count=0; while(waitpid($pid, WNOHANG)){ sleep 1; $count++; print "warte schon $count Sekunden\n"; # Kind abwürgen (9 = SIGKILL) if($count > 37 ){ kill(9,$pid); print "Toete $pid\n"; } } } sleep(20); }