From 41e56d488bc8f08dbd4d15b66bcbfa7c47fe0417 Mon Sep 17 00:00:00 2001 From: Bernhard Tittelbach Date: Wed, 2 Oct 2013 22:19:26 +0000 Subject: [PATCH 1/1] checkphone.pl with zmq doordaemon --- checkphone.pl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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); } -- 1.7.10.4