diff --git a/uptracker.cgi b/uptracker.cgi index 3a76fc765..e2cddd881 100755 --- a/uptracker.cgi +++ b/uptracker.cgi @@ -41,9 +41,21 @@ else { print "\n"; +$start = time(); while(1) { sleep(1); - open(UPFILE, $upfile) || next; + $now = time(); + if (!open(UPFILE, $upfile)) { + # Doesn't exist yet + if ($now - $start > 60) { + # Give up after 60 seconds + print "\n"; + last; + } + next; + } @lines = ; chop(@lines); close(UPFILE); @@ -58,7 +70,6 @@ while(1) { } # Check if there has been no activity for 60 seconds - $now = time(); if ($size == $last_size) { if ($last_time && $last_time < $now-60) { # Too slow! Give up