From: Bernhard Tittelbach Date: Wed, 2 Oct 2013 22:19:26 +0000 (+0000) Subject: checkphone.pl with zmq doordaemon X-Git-Url: https://git.realraum.at/?a=commitdiff_plain;h=41e56d488bc8f08dbd4d15b66bcbfa7c47fe0417;p=svn42.git checkphone.pl with zmq doordaemon --- diff --git a/checkphone.pl b/checkphone.pl index 41f9514..979c838 100755 --- a/checkphone.pl +++ b/checkphone.pl @@ -4,9 +4,7 @@ use Socket; use strict; my $fh; -my $socketfile = $ARGV[0] || "/var/run/tuer/door_cmd.socket"; -sleep(1) while (! -S $socketfile); -my $socketaddr = sockaddr_un($socketfile); +my $zmqclient = "/flash/tuer/door_client_zmq"; my $keys; my %good; @@ -20,8 +18,9 @@ while (<$keys>) $good{$1}=$2; } } -my $id = $ARGV[2]; -my $action = $ARGV[1]; +my $id = $ARGV[1]; +$id =~ s/^0/+43/; +my $action = $ARGV[0]; if ($good{$id}) { if ($action == 1591) @@ -41,8 +40,9 @@ exit 0; sub send_to_fifo { - socket(my $conn, PF_UNIX, SOCK_STREAM,0) || die "socket: $!"; - connect($conn, $socketaddr) || die "socket connect: $!"; + open(my $conn, "| ".$zmqclient); + #socket(my $conn, PF_UNIX, SOCK_STREAM,0) || die "socket: $!"; + #connect($conn, $socketaddr) || die "socket connect: $!"; print $conn shift(@_)."\n"; close($conn); }