Debian Codegraph @

script/ecaccess-gateway-connected

raw
1 #!/usr/bin/perl -w
2 #
3 # ecaccess-gateway-connected: Display the ECaccess Gateway Connection Status
4 #
5 # [email protected] - 2010-10-15
6
7 use ECMWF::ECaccess;
8 use Getopt::Long;
9 use Pod::Usage;
10
11 my %opt = ( version => 0, help => 0, manual => 0, retry => 0, debug => 0 );
12
13 pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions(
14 \%opt,
15 qw(
16 version
17 help|?
18 manual
19 retry=i
20 debug
21 )
22 );
23
24 # Display version if requested
25 die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} );
26
27 pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} );
28 pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} );
29
30 # Create the ECaccess Controler
31 my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug});
32
33 # Get the Control Channel
34 my $controlChannel = $ecaccess->getControlChannel();
35
36 # Display the Status of the Connection to ECMWF
37 print $controlChannel->gatewayIsConnected()->result ? "yes" : "no", "\n";
38
39 __END__
40
41 =head1 NAME
42
43 ecaccess-gateway-connected - Display the ECaccess Gateway Connection Status
44
45 =head1 SYNOPSIS
46
47 B<ecaccess-gateway-connected -version|-help|-manual>
48
49 B<ecaccess-gateway-connected [-debug]>
50
51 =head1 DESCRIPTION
52
53 Display the connection status of the ECaccess Gateway you are connected to.
54
55 =head1 OPTIONS
56
57 =over 8
58
59 =item B<-version>
60
61 Display version number and exits.
62
63 =item B<-help>
64
65 Print a brief help message and exits.
66
67 =item B<-manual>
68
69 Prints the manual page and exits.
70
71 =item B<-retry> I<count>
72
73 Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the
74 initial SSL connection initiated by the command to the ECMWF server. It does not
75 apply to all the subsequent requests made afteward as it is mainly targeting errors
76 that can happen from time to time during the SSL handshake. Default is no retry.
77
78 =item B<-debug>
79
80 Display the SOAP and SSL messages exchanged.
81
82 =back
83
84 =head1 EXAMPLES
85
86 B<ecaccess-gateway-connected>
87
88 Display the connection status of the current ECaccess Gateway.
89
90 =head1 SEE ALSO
91
92 B<ecaccess-gateway-list>, B<ecaccess-gateway-name>, B<ecaccess>.
93
94 =cut