From: Aleš Křenek Date: Tue, 7 Apr 2009 15:30:50 +0000 (+0000) Subject: test script for rotating IL files X-Git-Tag: branch_2_0_notif_GL31_root~5 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=a9de7354ee17142f26a545f74f6e25c8be6b1b3b;p=jra1mw.git test script for rotating IL files --- diff --git a/org.glite.lb.client/examples/test_notif_rotate.pl b/org.glite.lb.client/examples/test_notif_rotate.pl new file mode 100755 index 0000000..8514c7c --- /dev/null +++ b/org.glite.lb.client/examples/test_notif_rotate.pl @@ -0,0 +1,46 @@ +#!/usr/bin/perl + +use Socket; +use Fcntl; + +$notif = $ENV{NOTIFY_CMD} ? $ENV{NOTIFY_CMD} : './notify'; + +$notifid = shift or die "usage: $0 notifid\n"; + +socket SOCK,PF_INET,SOCK_STREAM,getprotobyname('tcp') || die "socket: $!\n"; +bind SOCK,sockaddr_in(0,INADDR_ANY) || die "bind: $!\n"; +listen SOCK,10; + +$fd = fileno SOCK; + +$flags = fcntl SOCK,F_GETFD,0; +fcntl SOCK,F_SETFD,$flags & ~FD_CLOEXEC; + + +$cmd = "$notif bind -s $fd $notifid"; + +system $cmd; + +die "failed $cmd\n" if $? == 1; +$ret = $? >> 8; +die "$cmd: $ret\n" if $ret; + +print "Bind ok. Press Enter ... "; <>; + +$fdin = ''; +vec($fdin,$fd,1) = 1; + +while (1) { + select($fdin,undef,undef,undef); + print "got connection\n"; + + $cmd = "$notif receive -s $fd -i 3"; + system $cmd; + die "failed $cmd\n" if $? == 1; + $ret = $? >> 8; + die "$cmd: $ret\n" if $ret; + +# print "Receive OK. Press Enter ..."; <>; +} + +