X-Git-Url: https://git.realraum.at/?p=svn42.git;a=blobdiff_plain;f=checkcard.pl;h=4e3816f6a50a68f302f38d7a64730b0f595f0862;hp=fb576be920eb8867663f076b994db06eedf3bba1;hb=050398149d26f27a0b19971cbcea990574d73a57;hpb=1ae303df55b1b9c631ac27e60d3bd3550fee7041 diff --git a/checkcard.pl b/checkcard.pl index fb576be..4e3816f 100755 --- a/checkcard.pl +++ b/checkcard.pl @@ -41,15 +41,22 @@ sub send_to_fifo read_keys(); -while (sleep 1) +while (sleep 2) { + send_to_fifo("log starting mifare-read"); open $fh,'/flash/tuer/mifare-read 0 2>&1 |'; read_keys() unless ($keys_last_read == -M ($keysfile)); - while (<$fh>) - { - next unless /UID/; + READLOOP: while (<$fh>) + { + unless (/UID/) + { + close($fh); + system("/usr/bin/killall -9 mifare-read"); + send_to_fifo("log restarting mifare-read after invalid output"); + last READLOOP; + } my ($id) = /UID=(\S+)\s+/; if ($good{$id}) {