| 1 |
#!/usr/bin/perl -w |
| 2 |
# |
| 3 |
# ecaccess-ectrans-list: List all ECtrans transfers |
| 4 |
# |
| 5 |
# [email protected] - 2010-10-15 |
| 6 |
|
| 7 |
use ECMWF::ECaccess; |
| 8 |
use Getopt::Long; |
| 9 |
use Pod::Usage; |
| 10 |
use Term::ReadKey; |
| 11 |
|
| 12 |
my %opt = ( version => 0, help => 0, manual => 0, retry => 0, debug => 0 ); |
| 13 |
|
| 14 |
pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions( |
| 15 |
\%opt, |
| 16 |
qw( |
| 17 |
version |
| 18 |
help|? |
| 19 |
manual |
| 20 |
retry=i |
| 21 |
debug |
| 22 |
) |
| 23 |
); |
| 24 |
|
| 25 |
# Display version if requested |
| 26 |
die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); |
| 27 |
my $ectransId = $ARGV[0]; |
| 28 |
|
| 29 |
pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} ); |
| 30 |
pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} ); |
| 31 |
|
| 32 |
# Create the ECaccess Controler |
| 33 |
my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug}); |
| 34 |
|
| 35 |
# Get the Token (using the Certificate in $HOME) |
| 36 |
my $token = $ecaccess->getToken(); |
| 37 |
|
| 38 |
# Get the Control Channel |
| 39 |
my $controlChannel = $ecaccess->getControlChannel(); |
| 40 |
|
| 41 |
if ( not($ectransId) ) { |
| 42 |
|
| 43 |
# Get the list of transfers |
| 44 |
my $transfers = $controlChannel->getTransferList($token); |
| 45 |
|
| 46 |
# Display the information for each transfer |
| 47 |
foreach $transfer ( $transfers->valueof('//getTransferListResponse/return') ) { |
| 48 |
printf "%-10s %-10s %-20s %-20s %s\n", $transfer->{transferId}, $transfer->{status}, $transfer->{ownerUserId}, $transfer->{hostName}, |
| 49 |
$transfer->{scheduledDate}; |
| 50 |
} |
| 51 |
} |
| 52 |
else { |
| 53 |
|
| 54 |
# Get the detail for the specified ectransId |
| 55 |
my $transfer = $controlChannel->getTransfer( $token, $ectransId )->valueof('//getTransferResponse/return'); |
| 56 |
print " Copyid: " . $transfer->{transferId} . "\n"; |
| 57 |
print " MS user: " . $transfer->{ownerUserId} . "\n"; |
| 58 |
print " Hostname: " . $transfer->{hostName} . "\n"; |
| 59 |
print " Status: " . $transfer->{status} . "\n"; |
| 60 |
print "Last error: " . $transfer->{lastErrorMessage} . "\n" if ( $transfer->{lastErrorMessage} ); |
| 61 |
print " Schedule: " . $transfer->{scheduledDate} . "\n"; |
| 62 |
print " Source: " . $transfer->{sourceFileName} . "\n"; |
| 63 |
print " Target: " . $transfer->{targetFileName} . "\n"; |
| 64 |
print " File size: " . $transfer->{fileSize} . "\n"; |
| 65 |
} |
| 66 |
|
| 67 |
# Logout |
| 68 |
END { |
| 69 |
$ecaccess->releaseToken($token) if ($token); |
| 70 |
} |
| 71 |
|
| 72 |
__END__ |
| 73 |
|
| 74 |
=head1 NAME |
| 75 |
|
| 76 |
ecaccess-ectrans-list - List all ECtrans transfers |
| 77 |
|
| 78 |
=head1 SYNOPSIS |
| 79 |
|
| 80 |
B<ecaccess-ectrans-list -version|-help|-manual> |
| 81 |
|
| 82 |
B<ecaccess-ectrans-list [-debug] [>I<ectrans-id>B<]> |
| 83 |
|
| 84 |
=head1 DESCRIPTION |
| 85 |
|
| 86 |
List all the ECtrans transfers in the ECtrans Spool. When an I<ectrans-id> is specified then |
| 87 |
the details for this transfer are displayed. |
| 88 |
|
| 89 |
The Transfer statuses can have the following values: |
| 90 |
|
| 91 |
=over 8 |
| 92 |
|
| 93 |
=item B<INIT> |
| 94 |
|
| 95 |
Files are being transferred to the spool. |
| 96 |
|
| 97 |
=item B<COPY> |
| 98 |
|
| 99 |
Files are being transferred to the remote site. |
| 100 |
|
| 101 |
=item B<WAIT> |
| 102 |
|
| 103 |
Files are scheduled and waiting to be started. |
| 104 |
|
| 105 |
=item B<RETR> |
| 106 |
|
| 107 |
File transfer will be retried. |
| 108 |
|
| 109 |
=item B<STOP> |
| 110 |
|
| 111 |
Files have NOT been successfully transferred (error). |
| 112 |
|
| 113 |
=item B<DONE> |
| 114 |
|
| 115 |
Files have been successfully transferred. |
| 116 |
|
| 117 |
=back |
| 118 |
|
| 119 |
=head1 ARGUMENTS |
| 120 |
|
| 121 |
=over 8 |
| 122 |
|
| 123 |
=item I<ectrans-id> (optional) |
| 124 |
|
| 125 |
The name of the ECtrans transfer to retrieve the details. |
| 126 |
|
| 127 |
=back |
| 128 |
|
| 129 |
=head1 OPTIONS |
| 130 |
|
| 131 |
=over 8 |
| 132 |
|
| 133 |
=item B<-version> |
| 134 |
|
| 135 |
Display version number and exits. |
| 136 |
|
| 137 |
=item B<-help> |
| 138 |
|
| 139 |
Print a brief help message and exits. |
| 140 |
|
| 141 |
=item B<-manual> |
| 142 |
|
| 143 |
Prints the manual page and exits. |
| 144 |
|
| 145 |
=item B<-retry> I<count> |
| 146 |
|
| 147 |
Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the |
| 148 |
initial SSL connection initiated by the command to the ECMWF server. It does not |
| 149 |
apply to all the subsequent requests made afteward as it is mainly targeting errors |
| 150 |
that can happen from time to time during the SSL handshake. Default is no retry. |
| 151 |
|
| 152 |
=item B<-debug> |
| 153 |
|
| 154 |
Display the SOAP and SSL messages exchanged. |
| 155 |
|
| 156 |
=back |
| 157 |
|
| 158 |
=head1 EXAMPLES |
| 159 |
|
| 160 |
B<ecaccess-ectrans-list> I<124356> |
| 161 |
|
| 162 |
Give the informations concerning the ECtrans transfer I<124356>. |
| 163 |
|
| 164 |
B<ecaccess-ectrans-list> |
| 165 |
|
| 166 |
List all the ECtrans transfers in the Spool. |
| 167 |
|
| 168 |
=head1 SEE ALSO |
| 169 |
|
| 170 |
B<ecaccess-ectrans-delete>, B<ecaccess-ectrans-request>, B<ecaccess-ectrans-restart> and B<ecaccess>. |
| 171 |
|
| 172 |
=cut |