source: gs2-extensions/tdb-edit/trunk/src/bin/script/TDBClient.pl@ 27397

Last change on this file since 27397 was 27396, checked in by jmt12, 11 years ago

Allow the host to be configured (previously only supported port). This script is now used during Hadoop imports to startup and shutdown the server - and needs to also run on Medusa

  • Property svn:executable set to *
File size: 1.8 KB
Line 
1#!/usr/bin/perl
2
3# Setup Environment
4BEGIN
5{
6 die "GSDLHOME not set\n" unless defined $ENV{'GSDLHOME'};
7 die "GSDLOS not set\n" unless defined $ENV{'GSDLOS'};
8
9 unshift (@INC, "$ENV{'GSDLHOME'}/perllib");
10 unshift (@INC, "$ENV{'GSDLHOME'}/perllib/cpan");
11 unshift (@INC, "$ENV{'GSDLHOME'}/perllib/cpan/XML/XPath");
12 unshift (@INC, "$ENV{'GSDLHOME'}/perllib/plugins");
13 unshift (@INC, "$ENV{'GSDLHOME'}/perllib/classify");
14
15 if (defined $ENV{'GSDLEXTS'})
16 {
17 my @extensions = split(/:/,$ENV{'GSDLEXTS'});
18 foreach my $e (@extensions)
19 {
20 my $ext_prefix = "$ENV{'GSDLHOME'}/ext/$e";
21 unshift (@INC, "$ext_prefix/perllib");
22 unshift (@INC, "$ext_prefix/perllib/cpan");
23 unshift (@INC, "$ext_prefix/perllib/plugins");
24 unshift (@INC, "$ext_prefix/perllib/classify");
25 }
26 }
27 if (defined $ENV{'GSDL3EXTS'})
28 {
29 my @extensions = split(/:/,$ENV{'GSDL3EXTS'});
30 foreach my $e (@extensions)
31 {
32 my $ext_prefix = "$ENV{'GSDL3SRCHOME'}/ext/$e";
33 unshift (@INC, "$ext_prefix/perllib");
34 unshift (@INC, "$ext_prefix/perllib/cpan");
35 unshift (@INC, "$ext_prefix/perllib/plugins");
36 unshift (@INC, "$ext_prefix/perllib/classify");
37 }
38 }
39
40 # Manually installed CPAN package in GEXT*INSTALL
41 unshift (@INC, $ENV{'GEXTPARALLELBUILDING_INSTALLED'} . "/share/perl/5.12.4");
42}
43
44use strict;
45use warnings;
46
47use SocketsSwimmingThreadPoolClient;
48my $host = shift;
49my $port = shift;
50my $message = shift;
51die "Usage: perl client.pl <host> <port> <string>\n" unless defined($host) && defined($message) && defined($port);
52my $c= SocketsSwimmingThreadPoolClient->new(host=>$host,
53 port=>$port
54 );
55print "Contacting server on $host:$port\n";
56print "Sent: |$message|\n";
57print "Recv: |" . $c->query($message) . "|\n\n";
58exit;
Note: See TracBrowser for help on using the repository browser.